<script defer>
var select = document.all("Select");
select.options.length=1;
select.options[0].text=1;
select.options[0].value='小明';
select.options.length++;
select.options[1].text=2;
select.options[1].value='小李';
select.options.length++;
select.options[2].text=3;
select.options[2].value='小张';
select.selectedIndex=2;
</script>
<select name=Select>
</select>
var select = document.all("Select");
select.options.length=1;
select.options[0].text=1;
select.options[0].value='小明';
select.options.length++;
select.options[1].text=2;
select.options[1].value='小李';
select.options.length++;
select.options[2].text=3;
select.options[2].value='小张';
select.selectedIndex=2;
</script>
<select name=Select>
</select>
我具体一下吧。
如 var select = document.all("Select");
select.option[0].text=1;
select.option[0].value=小明;
select.option[1].text=2;
select.option[1].value=小李;
select.option[2].text=3;
select.option[2].value=小张;
我想向 select 发送1时。IE就能自动选择 小李.
select 发送2时。IE就能自动选择 小张.--------------------
我想发 myfun(1) 时。 把相应的 小李 的对应的selectedIndex 为选中的“黑体”状态
本人长期在线等待。
欢迎各界朋友。
msn [email protected]
QQ 1685132
var select = document.all("Select");
select.options.length=1;
select.options[0].text=1;
select.options[0].value='小明';
select.options.length++;
select.options[1].text=2;
select.options[1].value='小李';
select.options.length++;
select.options[2].text=3;
select.options[2].value='小张';
select.size=select.options.length;
function myfun(i)
{
select.selectedIndex=i;
}
</script>
<select name=Select>
</select>
<input type=button value=myfun onclick=myfun(1)>