I created this select dynamically in a page like:
var j=4;
mySELECT = document.createElement("SELECT");
mySELECT.name = "MEMBER" + j;
mySELECT.onclick = function (evt) { alert(this.name); }
myOPTION = document.createElement("OPTION");
myOPTION.value="1";
myTEXT=document.createTextNode("first");
myOPTION.appendChild(myTEXT);
mySELECT.appendChild(myOPTION);
myOPTION = document.createElement("OPTION");
myOPTION.value="2";
myOPTION.selected="true";
myTEXT=document.createTextNode("second");
myOPTION.appendChild(myTEXT);
mySELECT.appendChild(myOPTION);
myTD.appendChild(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 7 5096
> Could it be that it is not getting created in the form "update"? I need to have it created there.
Naw, it is being created in the <form> heirarchy.....
try document.all.item("MEMBER4").value
if this works, then it obviously isn't being created inside the form
"update"
:o)
"Michael Hill" <hi****@ram.lmtas.lmco.com> wrote in message
news:40***************@ram.lmtas.lmco.com... I created this select dynamically in a page like:
var j=4; mySELECT = document.createElement("SELECT"); mySELECT.name = "MEMBER" + j; mySELECT.onclick = function (evt) { alert(this.name); } myOPTION = document.createElement("OPTION"); myOPTION.value="1"; myTEXT=document.createTextNode("first"); myOPTION.appendChild(myTEXT); mySELECT.appendChild(myOPTION); myOPTION = document.createElement("OPTION"); myOPTION.value="2"; myOPTION.selected="true"; myTEXT=document.createTextNode("second"); myOPTION.appendChild(myTEXT); mySELECT.appendChild(myOPTION); myTD.appendChild(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['MEMBER
4'].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
Dominique wrote: try document.all.item("MEMBER4").value
if this works, then it obviously isn't being created inside the form "update" :o)
And then it only works in IE and perhaps Opera, since document.all is
IE-ism.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
lol* i didn't give you that to solve yer problem, i gave it to you to check
whether you CAN find the object
try this, add an ID attibute to it and call it by the getElementById (not
IE-ism) method
"Randy Webb" <hi************@aol.com> wrote in message
news:L5********************@comcast.com... Dominique wrote:
try document.all.item("MEMBER4").value
if this works, then it obviously isn't being created inside the form "update" :o)
And then it only works in IE and perhaps Opera, since document.all is IE-ism. -- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/
Dominique wrote: lol* i didn't give you that to solve yer problem, i gave it to you to check whether you CAN find the object
try this, add an ID attibute to it and call it by the getElementById (not IE-ism) method
"Randy Webb" <hi************@aol.com> wrote in message news:L5********************@comcast.com...
Dominique wrote:
try document.all.item("MEMBER4").value
if this works, then it obviously isn't being created inside the form "update" :o)
And then it only works in IE and perhaps Opera, since document.all is IE-ism.
Now you are making the mistake of assuming I am the one that posted the
original question. Perhaps if you spent as much time trying to learn
what you were doing, you would not be wasting as much time giving
incompetent answers.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
oh fukkoff randy
try giving a frikkin answer for once instead of giving snide remarks when
we're trying to help people here.
and sorry for not checking ur stoopid name in that last post, i'm busy
actually HELPING PEOPLE in other groups.
yer yapping and not helping, so just log off and go eat yer dinner, fukkin
prick.
and write better faq's on that crap website. learn some actual programming
skills, not theory.
"Randy Webb" <hi************@aol.com> wrote in message
news:Ma********************@comcast.com... Dominique wrote: lol* i didn't give you that to solve yer problem, i gave it to you to
check whether you CAN find the object
try this, add an ID attibute to it and call it by the getElementById
(not IE-ism) method
"Randy Webb" <hi************@aol.com> wrote in message news:L5********************@comcast.com...
Dominique wrote:
try document.all.item("MEMBER4").value
if this works, then it obviously isn't being created inside the form "update" :o)
And then it only works in IE and perhaps Opera, since document.all is IE-ism.
Now you are making the mistake of assuming I am the one that posted the original question. Perhaps if you spent as much time trying to learn what you were doing, you would not be wasting as much time giving incompetent answers.
-- Randy Chance Favors The Prepared Mind comp.lang.javascript FAQ - http://jibbering.com/faq/
Dominique wrote: lol* i didn't give you that to solve yer problem, i gave it to you to check whether you CAN find the object
try this, add an ID attibute to it and call it by the getElementById (not IE-ism) method
When I changed this:
mySELECT.name = "MEMBER" + j;
to this:
mySELECT.id = mySELECT.name = "MEMBER" + j;
if worked fine.
Thanks for the reminder.
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: RMD |
last post by:
I need to be able to keep a list of object references, and null them out one
by one at a later point in time. I realize this can be dangerous, but I have
my reasons.
I can't figure out, however,...
|
by: Mikhail Teterin |
last post by:
Hello!
Consider the following simple accessor function:
typedef struct {
int i;
char name;
} MY_TYPE;
const char *
|
by: David Sworder |
last post by:
Hi,
I've created a UserControl-derived class called MyUserControl that is
able to persist and subsequently reload its state. It exposes two methods as
follows:
public void Serialize(Stream...
|
by: Jongmin |
last post by:
Hi,
I have made two classes, which are simple and almost same,
T_A and T_B.
T_A has a static method overloaded to "==".
T_B dosn't.
And, I run the following code. I expect both "a" and "b"...
|
by: yossi.kreinin |
last post by:
Hi!
There is a system where 0x0 is a valid address, but 0xffffffff isn't.
How can null pointers be treated by a compiler (besides the typical
"solution" of still using 0x0 for "null")?
-...
|
by: toton |
last post by:
Hi,
In some cases when my function returns, I need to return a object of
null state. This is when I return object by value.
(Just like for by pointer, I can return a null pointer ).
It has to be...
|
by: lovecreatesbea... |
last post by:
Do you prefer malloc or calloc?
p = malloc(size);
Which of the following two is right to get same storage same as the
above call?
p = calloc(1, size);
p = calloc(size, 1);
|
by: MikeT |
last post by:
This may sound very elementary, but can you trap when your object is
set to null within the object?
I have created a class that registers an event from an object passed
in the constructor. When...
|
by: Francois Grieu |
last post by:
When running the following code under MinGW, I get
realloc(p,0) returned NULL
Is that a non-conformance?
TIA,
Francois Grieu
#include <stdio.h>
#include <stdlib.h>
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |