下拉列表onchange事件

<html>
<title>testpage</title>
<head>
<style>
 //style="overflow-y:hidden;overflow-x:hidden";
</style>
<script language="javascript" type="text/javascript">
function chg(){
 //var id=document.getElementById("showpage").value
   if(document.form1.slt.value=="11111"){
    document.getElementById("showpage").style.display="";
    document.getElementById("showit").style.display="";
   }
    if(document.form1.slt.value=="22222"){
    document.getElementById("showpage").style.display="none";
    document.getElementById("showit").style.display="none";
   }
  
  if(document.form1.slt.value=="33333"){
      document.getElementById("showpage").style.display="";
  }
  if(document.form1.slt.value=="55555"){
    document.getElementById("showit").style.display="none";
  }
 
 
}
</script>
</head>
<body>
 <form action="#" name="form1" method="post">
 <select name="slt" οnchange="chg()">
   <option>please select</option>
   <option value="11111">11111</option>
   <option value="22222">22222</option>
   <option value="33333">33333</option>
   <option value="44444">44444</option>
   <option value="55555">55555</option>
 </select>
 <br />
 <input name="showpage" type="text" value="this is a test page"  style="display:none;border-left:0px;border-top:0px;border-right:0px;border-bottom:1px solid #ff0000 " />
 <div id="showit">good for you</div>
 </form>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值