1.网址:
http://www.cnblogs.com/Herist/archive/2007/09/24/903890.html
http://www.cnblogs.com/xiangpiaopiao2011/archive/2011/06/15/2081580.html
2.代码总结
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>第一个简单的jQuery程序</title> <script language="javascript" type="text/javascript" src="Jscript/jquery-1.4.2.min.js"></script> <script type="text/javascript"> var selectIndex='1'; /*获取选择的value*/ function clickSelect(){ selectIndex="1"; var obj = document.getElementById("select"); selectIndex = obj.selectedIndex; } function changeSelect(){ var selectVal = $("#select").val(); //获取选中记录的value值 var selectText = $("#select option:selected").text(); //获取选中记录的text值 // alert(selectVal +":"+selectText); //ajax if(selectVal=='2'){//如果是2 需要提醒 var r=confirm("danger是否确认选择?"); if (r==true) { alert("更新成功"); }else{ var obj = document.getElementById("select"); obj.options[selectIndex].selected = true; //保持选中状态 } }else{ } } </script> </head> <body> <select id="select" onclick="clickSelect()" onchange="changeSelect()"> <option value="1">一</option> <option value="2">二</option> <option value="3">三</option> <option value="4">四</option> <option value="5">五</option> <option value="6">六</option> <option value="7">七</option> <option value="8">八</option> <option value="9">九</option> </select> </body> </html>