I have two combo-box:
<select ID="combobox1"></select>
<select ID="combobox2" onChange="get_function(this, #combobox1)"></select>
What I want to do is, passing the value chosen on the combobox1 to the combobox2 and call the Javascript function:
function get_function(combobox1, combobox2)
{
var code1 = combobox1.value;
var code2 = combobox2.value;
if (!code1) return;
if (!code2) return;
alert(code1 + '-' + code2);
}
I have tried that code but it doesn’t work. How can I do that?
UPDATE
The problem solved by:
<select ID="combobox1"></select>
<select ID="combobox2" onChange="get_function(this, "combobox1")"></select>
function get_function(combobox1, combobox2)
{
var code1 = combobox1.value;
var code2 = document.getElementById(combobox2);
if (!code1) return;
if (!code2) return;
alert(code1 + '-' + code2);
}
1 Answer