Click to See Complete Forum and Search --> : Multiple Successive Prompts


ollmorris
12-26-2002, 10:05 AM
How can I have a new prompt popup when OK is clicked on one prompt?

Thanks

AdamBrill
12-26-2002, 12:44 PM
Try this:


test=prompt();
if(test!=null)
{
test2=prompt();
}


this will only popup the second one if you click ok on the first one.

ollmorris
12-26-2002, 01:38 PM
How do I have them popup any number of times if the user clicks ok?

Thanks for your reply!

AdamBrill
12-26-2002, 02:45 PM
To do three, do this:


<script language=javascript>
test=prompt();
if(test!=null)
{
test2=prompt();
}
if(test2!=null)
{
test3=prompt();
}
</script>


to do like 10, do this:


<script language=javascript>
test = new Array();
for(x=0;x<10;x++)
{
test[x]=prompt();
if(test[x]==null)
{
break;
}
}
</script>



All of there answers are in the array test. That should work. Let me know if it doesn't...

ollmorris
12-26-2002, 03:38 PM
Thanks it works fine and is jsut what I wanted. Is there anyway I can have unlimited?

I am a PHP developer and I didn't know how close JS and PHP were!

Thanks

AdamBrill
12-26-2002, 04:09 PM
Why do you want to do that??? I wouldn't suggest doing that. Users don't like a lot of popup windows to come up when they go onto a site. But this is how you would do it:


<script language=javascript>
test = new Array();
x=1;
do
{
test[x]=prompt();
if(test[x]==null)
{
x=0;
}
}while(x==1);
</script>


Like I said, though, I wouldn't suggest that you do it. The above script will pop them up endlessly until they select cancel.

ollmorris
12-26-2002, 04:16 PM
I need it to create something like the List button in VBulletin. (i.e you can have as many options as you want)

THanks