1 <html> 2 <head> 3 <title>选择框</title> 4 <script language="JavaScript"> 5 6 function change(rurl){ 7 window.location=rurl; 8 } 9 function myFunction(){ 10 var x; 11 var r=confirm("按下按钮!"); 12 if (r==true){ 13 x="你按下了\"确定\"按钮!"; 14 } 15 else{ 16 x="你按下了\"取消\"按钮!"; 17 } 18 document.getElementById("demo").innerHTML=x; 19 } 20 </script> 21 </head> 22 <body> 23 <p>点击按钮,显示确认框。</p> 24 <button onclick="myFunction()">点我</button> 25 <p id="demo"></p> 26 27 <select onchange="change(this.value)"> 28 <option value="#">请选择要浏览的网页</option> 29 <option value="http://www.baidu.com">百度</option> 30 <option value="http://www.taobao.com">淘宝</option> 31 <option value="http://www.jingdong.com">京东</option> 32 </select> 33 34 35 </body> 36 </html>