<select name=s1 id=s1>
<option value=1>1</option>
<option value=2>2</option>
</select><script> var objs=document.getElementById('s1')
var i=objs.options.length-1
while i>=0 {
objs.options.remove(i);
i--;
}
</script>上面的代码在firefox中不能用。
怎么办
<option value=1>1</option>
<option value=2>2</option>
</select><script> var objs=document.getElementById('s1')
var i=objs.options.length-1
while i>=0 {
objs.options.remove(i);
i--;
}
</script>上面的代码在firefox中不能用。
怎么办
<option value=1>1</option>
<option value=2>2</option>
</select><script>var objs=document.getElementById('s1')
var i=objs.options.length-1
while i>=0 {
objs.options.remove(i);
i--;
}
</script>
-----objs.option.length = 0
<script>
function f1()
{
var objs=document.getElementById("s1");
var i=objs.options.length-1; while (i>=0)
{
var node=document.getElementById("option"+i);
node.parentNode.removeChild(node);
i--;
} }
</script><select name=s1 id=s1>
<option value=1 id="option1">1</option>
<option value=2 id="option0">2</option></select>
<input type=button onclick="f1()" value="ooooo">
objs.option.length = 0
即可
即可.
怎么这条也不行??
不行啊 老大!
var i=objs.options.length-1 alert(i)
i显示为1