Need help with onChange

M

Mel

Warning: Newbeeeeeeeeeee

I have created my form elements already.
after form creations i am attempting to add an onChange to one of my
Select(s) with ID=S100

here is the code:
---------------------------------------------------------
function onChangeCB(ename,flag,url) {
alert('onChangeCB');
}

function selectCB(ename,flag,url) {
alert('selectCB');

document.getElementById(ename).onChange=function()
{onChangeCB(ename,flag,url);}
}

selectCB('S100',1,'http://www.yahoo.com')
 
B

brunascle.maps

Warning: Newbeeeeeeeeeee

I have created my form elements already.
after form creations i am attempting to add an onChange to one of my
Select(s) with ID=S100

here is the code:
---------------------------------------------------------
function onChangeCB(ename,flag,url) {
alert('onChangeCB');

}

function selectCB(ename,flag,url) {
alert('selectCB');

document.getElementById(ename).onChange=function()
{onChangeCB(ename,flag,url);}

}

selectCB('S100',1,'http://www.yahoo.com')

lol funny, i had to actually put this into an HTML and run it myself
because i couldnt see what the problem was.

"onchange" has to be all lowercase. if you change it to this it will
work:

document.getElementById(ename).onchange= function()
{onChangeCB(ename,flag,url);}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,538
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top