C
Chuck Anderson
Okay, ... so I'm playing around with forms and wrote a JavaScript
function that loops through all form elements and displays every option
in every select field with an alert for each one.
var els = form.elements;
var l = els.length;
for (var i=0; i<l; i++) // loop through all form elements
{
if (els.type.substring(0,6) == 'select')
{
var options = els.options;
for (var j=0, len=options.length; j<len; j++)
{
alert(els.name + ' option ' + j + ' = "' + options[j].text + '"')
}
}
}
In the form I am using this results in many alert boxes popping up.
This seems like a very, very basic question, but I've Googled it quite a
bit and can not find an answer. Is there a way to manually abort that
script (other than closing my browser) or do I have to keep clicking OK
until the loop has run it's complete course?
function that loops through all form elements and displays every option
in every select field with an alert for each one.
var els = form.elements;
var l = els.length;
for (var i=0; i<l; i++) // loop through all form elements
{
if (els.type.substring(0,6) == 'select')
{
var options = els.options;
for (var j=0, len=options.length; j<len; j++)
{
alert(els.name + ' option ' + j + ' = "' + options[j].text + '"')
}
}
}
In the form I am using this results in many alert boxes popping up.
This seems like a very, very basic question, but I've Googled it quite a
bit and can not find an answer. Is there a way to manually abort that
script (other than closing my browser) or do I have to keep clicking OK
until the loop has run it's complete course?