日期:2014-05-16 浏览次数:20370 次
<select name="SLk1" id="SLk1" size="1"><option value="OBW">That Begins With</option><option value="OOS">That Contains</option><option value="OEM" selected="true">That Equals</option></select>
var sel = document.getElementById('SLk1');
...
sel.removeChild(sel.options[0]);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function test(){
var sel = document.getElementById('SLk1');
if(sel.options[0])
sel.removeChild(sel.options[0]);
}
</script>
</head>
<body>
<select name="SLk1" id="SLk1" size="1" style="width:200px;" >
<option value="OBW">That Begins With</option>
<option value="OOS">That Contains</option>
<option value="OEM" selected="selected">That Equals</option>
</select>
<br />
<input type="button" onclick="test()" value="测试" />
</body>
</html>