Click here to Skip to main content
15,886,873 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: how to add minimize and maximize buttons in a dfd in my company intranet Pin
Shahriar Iqbal Chowdhury/Galib8-Jul-11 10:49
professionalShahriar Iqbal Chowdhury/Galib8-Jul-11 10:49 
GeneralRe: how to add minimize and maximize buttons in a dfd in my company intranet Pin
Dan muli8-Jul-11 20:41
Dan muli8-Jul-11 20:41 
AnswerRe: how to add minimize and maximize buttons in a dfd in my company intranet Pin
Shameel11-Jul-11 21:42
professionalShameel11-Jul-11 21:42 
GeneralRe: how to add minimize and maximize buttons in a dfd in my company intranet Pin
Dan muli11-Jul-11 21:54
Dan muli11-Jul-11 21:54 
GeneralRe: how to add minimize and maximize buttons in a dfd in my company intranet Pin
Shameel12-Jul-11 3:45
professionalShameel12-Jul-11 3:45 
GeneralRe: how to add minimize and maximize buttons in a dfd in my company intranet Pin
Pete O'Hanlon12-Jul-11 4:40
mvePete O'Hanlon12-Jul-11 4:40 
GeneralRe: how to add minimize and maximize buttons in a dfd in my company intranet Pin
Shameel12-Jul-11 8:34
professionalShameel12-Jul-11 8:34 
QuestionEfficiency of adding arrays to an array Pin
Online.Cop8-Jul-11 1:43
Online.Cop8-Jul-11 1:43 
I have a large list of authors, book titles, and comments in an SQL database. I am able to pull those records with PHP.

I want to populate a web form with this information dynamically (Javascript), but since I have never used AJAX or json, I've not known how to do this any other way.

So what I've done is have my PHP generate a 2D Javascript array which contains all of the entries like this:
var author_title_comment = new Array();

author_title_comment.push( new Array("Author 1", "Title 1", "Comment 1") );
author_title_comment.push( new Array("Author 2", "Title 2", "Comment 3") );
...
author_title_comment.push( new Array("Author 3999", "Title 3999", "Comment 3999") );
author_title_comment.push( new Array("Author 4000", "Title 4000", "Comment 4000") );


It's not pretty, but it functions well locally.

The same thing could probably be re-written like this:

var author_title_comment = [];

author_title_comment[author_title_comment.length] = new Array("Author 1", "Title 1", "Comment 1");
author_title_comment[author_title_comment.length] = new Array("Author 2", "Title 2", "Comment 2");
...
author_title_comment[author_title_comment.length] = new Array("Author 3999", "Title 3999", "Comment 3999");
author_title_comment[author_title_comment.length] = new Array("Author 4000", "Title 4000", "Comment 4000");


Since the push() function can handle more than a single entry[^], would this be more efficient:
var author_title_comment = new Array();

author_title_comment.push(
   new Array("Author 1", "Title 1", "Comment 1"),
   new Array("Author 2", "Title 2", "Comment 3"),
...
   new Array("Author 3999", "Title 3999", "Comment 3999"),
   new Array("Author 4000", "Title 4000", "Comment 4000")
);


So I can either 1: use author_title_comment.push( new Array("Author 1", "Title 1", "Comment 1") ); on every element I want to add. 2: use author_title_comment[author_title_comment.length] = new Array("Author 1", "Title 1", "Comment 1"); on each element, or 3: use a single push() with all 4000 elements as additional parameters.

Or #4, learn a better way to do this and have the content dynamically generated whenever the user adds/removes a new author name, book title, or comment. Poke tongue | ;-P
AnswerRe: Efficiency of adding arrays to an array Pin
Not Active8-Jul-11 2:00
mentorNot Active8-Jul-11 2:00 
Questionhow can i insert onClick event to href? Pin
buffering836-Jul-11 2:58
buffering836-Jul-11 2:58 
AnswerRe: how can i insert onClick event to href? Pin
Manfred Rudolf Bihy6-Jul-11 3:18
professionalManfred Rudolf Bihy6-Jul-11 3:18 
GeneralRe: how can i insert onClick event to href? Pin
buffering836-Jul-11 5:32
buffering836-Jul-11 5:32 
GeneralRe: how can i insert onClick event to href? Pin
buffering836-Jul-11 5:51
buffering836-Jul-11 5:51 
GeneralRe: how can i insert onClick event to href? Pin
Manfred Rudolf Bihy6-Jul-11 6:14
professionalManfred Rudolf Bihy6-Jul-11 6:14 
GeneralRe: how can i insert onClick event to href? Pin
Hà Duy Thuận10-Jan-12 22:14
Hà Duy Thuận10-Jan-12 22:14 
GeneralRe: how can i insert onClick event to href? Pin
Ali Al Omairi(Abu AlHassan)6-Jul-11 11:13
professionalAli Al Omairi(Abu AlHassan)6-Jul-11 11:13 
GeneralRe: how can i insert onClick event to href? Pin
Manfred Rudolf Bihy8-Jul-11 1:59
professionalManfred Rudolf Bihy8-Jul-11 1:59 
AnswerRe: how can i insert onClick event to href? Pin
Ali Al Omairi(Abu AlHassan)6-Jul-11 3:25
professionalAli Al Omairi(Abu AlHassan)6-Jul-11 3:25 
GeneralRe: how can i insert onClick event to href? Pin
buffering836-Jul-11 5:34
buffering836-Jul-11 5:34 
GeneralRe: how can i insert onClick event to href? Pin
buffering836-Jul-11 5:51
buffering836-Jul-11 5:51 
GeneralRe: how can i insert onClick event to href? Pin
Ali Al Omairi(Abu AlHassan)6-Jul-11 11:07
professionalAli Al Omairi(Abu AlHassan)6-Jul-11 11:07 
AnswerRe: how can i insert onClick event to href? Pin
Not Active6-Jul-11 7:41
mentorNot Active6-Jul-11 7:41 
GeneralRe: how can i insert onClick event to href? Pin
Ali Al Omairi(Abu AlHassan)6-Jul-11 11:08
professionalAli Al Omairi(Abu AlHassan)6-Jul-11 11:08 
Questionhow do save div to html file Pin
apadana_19896-Jul-11 2:05
apadana_19896-Jul-11 2:05 
AnswerRe: how do save div to html file Pin
Richard MacCutchan6-Jul-11 2:21
mveRichard MacCutchan6-Jul-11 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.