代码是最好的解释,请看代码,呵呵!
代码
<option>4</option>
<option>5</option>
<option>6</option>
<option>9</option>
<option>10</option>
<option>14</option>
<option>15</option>
<option>16</option>
</select>
</th>
function ChangeCustomId(obj) {
var opt = obj.options[obj.selectedIndex]
//alert("The option you select is:" + opt.text + "(" + opt.value + ")");
var opt = obj.options[obj.selectedIndex]
var selectItem = document.getElementsByName("mySelect1");
for (i = 0; i < selectItem.length; i++) {
selectItem[i].selectedIndex = obj.selectedIndex;
}
}
var opt = obj.options[obj.selectedIndex]
//alert("The option you select is:" + opt.text + "(" + opt.value + ")");
var opt = obj.options[obj.selectedIndex]
var selectItem = document.getElementsByName("mySelect1");
for (i = 0; i < selectItem.length; i++) {
selectItem[i].selectedIndex = obj.selectedIndex;
}
}
<select id="mySelect" name="mySelect" onchange="ChangeCustomId(this)"><option>1</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>9</option>
<option>10</option>
<option>14</option>
<option>15</option>
<option>16</option>
</select>
</th>
function ChangeCustomId(obj) {
var opt = obj.options[obj.selectedIndex]
//alert("The option you select is:" + opt.text + "(" + opt.value + ")");
var opt = obj.options[obj.selectedIndex]
var selectItem = document.getElementsByName("mySelect1");
for (i = 0; i < selectItem.length; i++) {
selectItem[i].selectedIndex = obj.selectedIndex;
}
}