Jump to content

combo box


ilikephp

Recommended Posts

Hello!

 

I have this code that creates dependent combo box

 

How can I add: Select option" before the user selects option 2a, 2b or 2c

"select option" should have no value

 

Thank you,

 

<html>
<head>
<title>Dependent Combo Boxes</title>
</head>
<body>
<script type='text/javascript'>
function update(a)
{
if(a==1)
{
document.getElementById("destination").innerHTML="<select name='combo2'><option>option 1 a</option><option>option 1b</option><option>option 1c</option></select>";
}
if(a==2)
{
document.getElementById("destination").innerHTML="<select name='combo2'><option>option 2 a</option><option>option 2b</option><option>option 2c</option></select>";
}
if(a==3)
{
document.getElementById("destination").innerHTML="<select name='combo2'><option>option 3 a</option><option>option 3b</option><option>option 3c</option></select>";
}
}
</script>
<form name='form1'>
<table>
<tr><td><select name='combo1'  onchange='update(this.value)'>
<option value='1'>option 1</option>
<option value='2'>option 2</option>
<option value='3'>option 3</option>
</select>
</td></tr>
<tr><td>
<span id='destination'>
<select name='combo2' disabled='disabled' >
<option>Select combo 1 first</option>
</select>
</span>
</td></tr>

</form>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/223206-combo-box/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.