Javascript/html onChange multiple parms issue
Posted: Thu Feb 24, 2011 11:04 am
Has anyone had trouble passing multiple select values in to a javascript function? I have a function that takes 4 parms, when I run the function in the window.onload, it works just fine. When I'm trying to run the same function in an onChange, I can only get it to work with one parm.
<select name="Name" id="Name" onchange="listSelects('Name='+document.getElementById('Name').value, 'Name2='+document.getElementById('Name2').value, 'Name3='+document.getElementById('Name3').value, 'Name4='+document.getElementById('Name4').value)">
I may be doing this completely incorrect, but am trying to learn. If I run it as:
<select name="Name" id="Name" onchange="listSelects('Name='+document.getElementById('Name').value)">
it works just fine, but I need the other 3 values passed.
The javascript function is in an external .js file, which calls .php files etc.
I have been searching online with no luck, any help would be greatly appreciated.
<select name="Name" id="Name" onchange="listSelects('Name='+document.getElementById('Name').value, 'Name2='+document.getElementById('Name2').value, 'Name3='+document.getElementById('Name3').value, 'Name4='+document.getElementById('Name4').value)">
I may be doing this completely incorrect, but am trying to learn. If I run it as:
<select name="Name" id="Name" onchange="listSelects('Name='+document.getElementById('Name').value)">
it works just fine, but I need the other 3 values passed.
The javascript function is in an external .js file, which calls .php files etc.
I have been searching online with no luck, any help would be greatly appreciated.