PDA

View Full Version : Need help debugging simple script



TravisMath
Aug 26th, 2005, 01:11 AM
Can someone tell me why the following script does not work? I can't figure out why. Just attach it to a blank html page and call the function from the body onload tag.



a = new Array()
a[0] = "A1";
a[1] = "A2";
a[2] = "A3";
a[3] = "A4";
a[4] = "A5";
function Run() {
for(i=0;i<a.length;i++) {
alert(a[i]) }



Thanks

KC-Luck
Aug 26th, 2005, 01:56 AM
you either need to take the { before alert off, or add } after the alert


function Run()
{
for(i=0;i<a.length;i++)
alert(a[i])

}
or

function Run()
{
for(i=0;i<a.length;i++)
{
alert(a[i])
}
}