View Full Version : Array and Dialog box

01-05-2011, 12:44 AM
Hey Scripters,

I need to complete a task for a friend and I am stuck at this part. I am new with Javascript but I'm his only friend that knows a bit of Javascript.

So for this problematic part of my task, I need to use tables and dialog boxes.

First of all I need to define an array of 3 elements. Each element is associated with a different first name.

Then I shall realize a first function to add a name in the table. The function takes as parameter the table previously created and return it containing an additional element whose value is the name that the visitor wants to add. I must use the dialog box prompt so that the user can specify the name he wishes to add in the table.

I shall also perform a second function which will display the name that is included in the different array elements. This function will also take the table in parameters and proceed with setting the display name with a dialog box alert type that contains all of the name separated by ";".

Help is very much appreciated.

Please don't post links, I need explanations, so that I can understand next time I encounter this situation.

01-05-2011, 01:25 AM
Do you have an attempt at this homework assignment?

See: http://www.webdeveloper.com/forum/forumdisplay.php?f=3&order=desc&daysprune=30

Old Pedant
01-05-2011, 02:25 AM
jmrker means specifically

It's considered bad netiquette to crosspost the same question in different forums. Somebody will spend a bunch of time answering you only to find out that the question was already answered in the other forum. At a minimum, you should mention where else you have posted the question.

But anyway, look here:

And look at rule 1.5, especially.

You will, I am sure, pardon us if we are more than skeptical about your claim that this is "a task for a friend." Unless you mean your friend is the person who has this homework assignment.

Why do we KNOW this is homework? Quite simply because it has no possible use in the real world. I could see something like this being used as a way to add "friends" to a list of existing friends. But since the list will not be visible on any computer except the one where the name was added, it clearly has no practical purpose. Couple that with the requirement that you must use a "dialog box prompt" and then display the result via an "alert type that contains all of the name" and we know it's not something you would use on a real website. It's a beginning level homework assignment.

*IF* you do some of the work and show us what you have done and tell us what parts work and what parts don't, *THEN* you could well get some help. But we won't do the entire homework for you.

01-05-2011, 02:38 AM
jmrker means specifically
*IF* you do some of the work and show us what you have done and tell us what parts work and what parts don't, *THEN* you could well get some help. But we won't do the entire homework for you.

Boy, you took a lot of words to say what I meant! :eek::):D

Old Pedant
01-05-2011, 02:43 AM

I just get so tired of these "doing this for a friend" or "I urgently need help for my website" or ...

All the possible ways of not admitting that this is a homework assignment.

It's like they all think we are certified idiots. Have they never looked at a real website, to see how much more complex it is than these toy assignments? Or, even when the sites aren't complex, have they ever seen one that *really* asked questions using prompt boxes and gave answers with alerts???