select标签onchange事件

来源:互联网 发布:怎么注册多个淘宝账号 编辑:程序博客网 时间:2024/05/28 05:13
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<select onchange="bao(this.options[this.options.selectedIndex].value)">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</body>
<script>
function bao(x){
if(x==4)
{
var input=document.createElement("input");
var o = document.body;
input.type="text";
o.appendChild(input);
}
}
</script>
</html>
原创粉丝点击