<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>测试js</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script type="text/javascript" language="javascript">... var selIndex; function indx()...{ selIndex=document.getElementById('list1').options.selectedIndex; } function chk(val)...{ var selIndex2=document.getElementById('list1').selectedIndex; if(confirm('你真的要选择'+val))...{ document.getElementById('list1').options[selIndex2].selected='selected'; selIndex=selIndex2; return true; }else...{ document.getElementById('list1').options[selIndex].selected='selected'; } } </script> </head> <body onLoad="indx()"> <form method="get" ><select size="1" name="list1" id="list1" onChange="chk(this.options[this.options.selectedIndex].text)"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option></select></form> </body></html>