日期:2014-05-16 浏览次数:20333 次
<input type="button" value="点击" onclick="document.getElementById('sel').style.display='block'"/> <select id="sel" style="width:auto;display:none" > <option value="1">onmouseover</option> <option value="2">onmouseout</option> <option value="3">onfocus</option> <option value="4">onblur</option> </select> <script> document.getElementById('sel').onchange=function(){ var x=["","onmouseover","onmouseout","onfocus","onblur"]; alert(x[this.value]); } </script>
------解决方案--------------------
网上搜下下拉列表,有很多的。
这是个最简单的
<html> <head> <script type="text/javascript"> var i = 0; function method(){ var contentTag = document.getElementById("content"); if(i==0){ contentTag.style.display="";//display=""是把div显示出来 i = 1; }else if(i==1){ contentTag.style.display="none";//display="none"是把div不显示出来 i = 0; } } </script> <title>Haha</title> </head> <body> <center> <span id="dw" onclick="method();">点我试试</span> <div id="content" style="display:none;width:50px;height:100px;background-color:#dde3ec"> <a href="#">连接1</a> <a href="#">连接2</a> <a href="#">连接3</a> </div> </center> </body> </html>