PDA

View Full Version : document.formname("element name") doesn't work in Netscape..AHHH, why?


BrightNail
11-12-2002, 07:11 AM
hey all,

I have this part code;

for (a=0;a<num+1;a++){
p=0;
if (y!="stage"+a){
document.Event("stage"+a).options.length=0;
for (i=0;i<groups;i++){
if(i >= x){
document.Event("stage"+a).options[p]=new Option(group[a][i].text);
p++;
}
}
}

in IE, works like a breeze....BUT IN NETSCAPE ....it reads Event as a function call cause it is enclosed in parenthisis, rather than the element name which is what I am intending...

this is lame..why can IE know what I am trying to do, but not Netscape..is there a workaround as I reiterate thru the "names" of the select boxes......(since there are numerous select boxes on the page, and some I don't want to deal with..only the ones with the "stage" name).......?

please advise.......

glenngv
11-12-2002, 07:47 AM
try:

document.Event.elements["stage"+a]

if that still doesn't work, rename Event as your form name, maybe it is a reserved word or identifier in NS

document.frmEvent.elements["stage"+a]

BrightNail
11-12-2002, 07:51 AM
yeah, I stumbled upon this and it works...thanks..appreciate it...