I created this select dynamically in a page like:
var j=4;
mySELECT = document.create Element("SELECT ");
mySELECT.name = "MEMBER" + j;
mySELECT.onclic k = function (evt) { alert(this.name ); }
myOPTION = document.create Element("OPTION ");
myOPTION.value= "1";
myTEXT=document .createTextNode ("first");
myOPTION.append Child(myTEXT);
mySELECT.append Child(myOPTION) ;
myOPTION = document.create Element("OPTION ");
myOPTION.value= "2";
myOPTION.select ed="true";
myTEXT=document .createTextNode ("second");
myOPTION.append Child(myTEXT);
mySELECT.append Child(myOPTION) ;
myTD.appendChil d(mySELECT);
But then when I try to access it with either:
document.update .elements['MEMBER4'].value
or
document.update .MEMBER4.value
or
document.update .elements['MEMBER4'].options[document.update .elements['MEMBER4'].selectedIndex].text;
I get blah, blah ... 'is null or not an object'.
I can see the object on the page and when I click on it I get the alert
message showing the name is "MEMBER4".
I am stumped why I am getting this message. Something must not be right.
Could it be that it is not getting created in the form "update"? I need
to have it created there.
Any help is appreciated.
Mike
var j=4;
mySELECT = document.create Element("SELECT ");
mySELECT.name = "MEMBER" + j;
mySELECT.onclic k = function (evt) { alert(this.name ); }
myOPTION = document.create Element("OPTION ");
myOPTION.value= "1";
myTEXT=document .createTextNode ("first");
myOPTION.append Child(myTEXT);
mySELECT.append Child(myOPTION) ;
myOPTION = document.create Element("OPTION ");
myOPTION.value= "2";
myOPTION.select ed="true";
myTEXT=document .createTextNode ("second");
myOPTION.append Child(myTEXT);
mySELECT.append Child(myOPTION) ;
myTD.appendChil d(mySELECT);
But then when I try to access it with either:
document.update .elements['MEMBER4'].value
or
document.update .MEMBER4.value
or
document.update .elements['MEMBER4'].options[document.update .elements['MEMBER4'].selectedIndex].text;
I get blah, blah ... 'is null or not an object'.
I can see the object on the page and when I click on it I get the alert
message showing the name is "MEMBER4".
I am stumped why I am getting this message. Something must not be right.
Could it be that it is not getting created in the form "update"? I need
to have it created there.
Any help is appreciated.
Mike
Comment