I have got my script like that
- Code: Select all
<script language="JavaScript" type="text/javascript">
<!-- hide
var multimedia_C = new Array("database", "system_software", "media", "www_publishing", ) ;
var multimedia_I = new Array("nothing") ;
var multimedia_H = new Array("java_wireless", "intro_java", ) ;
function swapOptions(the_array_name)
{
var the_select = window.document.upload.modules;
var the_array = eval(the_array_name);
for (loop=0; loop < the_array.length; loop++)
{
the_select.options[loop].text = the_array[loop];
}
}
// show me -->
</script>
and so in my page to call these function I do:
- Code: Select all
<select name="pathway" onChange="swapOptions(window.document.upload.pathway.options[selectedIndex].value);">
<option selected>-- choose a pathway --</option>
<option value="information-technology_C">Information Technology</option>
<option value="internet-technology_C">Internet Technology</option>
<option value="multimedia_C">Multimedia</option>
</select>
But this doesnt work....
I got an error like:
Line:140
char: 1
Error: Object Expected
and line 140 is the line with the onchange on it...
So I have tried just to check
- Code: Select all
<select name="pathway" onChange="alert(window.document.upload.pathway.options[selectedIndex].value);">
And its working, I mean I got the value of the selected line...
So wot s wrong when I call this function... and the target select is existing...
ps: I v found this functions on
http://hotwired.lycos.com/webmonkey/98/04/index3a_page10.html?tw=programming
Thanks
francois

