Click to See Complete Forum and Search --> : OnChange


aodhan
07-29-2003, 06:45 AM
I am trying to write some JavaScript code that open a new window and within this window sets up a drop down menu. I want this to call some function when I change a value in this box using onChange(). I am not sure if I am attempting this correctly. What I do is create a new window called d using the command d.write I try to add a form with all the details of menu in it. Any help on this matter would be greatly appreciated. Please find the code below:

the function test() gets called from a function elsewhere

function test(){
var d = 0;
var addWindow = window.open();
d = addWindow.document;
d.write('Please Select an option');
d.write("<FORM>type:<SELECT NAME='fieldType' onchange='tester()'><OPTION SELECTED VALUE='hidden'>hidden<OPTION VALUE='text'>text<OPTION VALUE='radio'>radio<OPTION VALUE='checkbox'>checkbox <OPTION VALUE='button'>button <OPTION VALUE='submit'>submit </SELECT>")

}

Maybe I am not even trying to do this the correct way!!

Khalid Ali
07-29-2003, 08:41 AM
Whats the error?

aodhan
07-29-2003, 08:42 AM
It just syas that there is a syntax error with the form that I try to write. Is it to do with quotes or something? Will this approach work?

Khalid Ali
07-29-2003, 09:16 AM
That does not help much,
I have used the code with NS6+ and IE6 on windows 2k machine...it works as intended,may your error is somewhere else...

as I said the error should say the syntax error at which line....mention that and if possible then post the entire code..