<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="js/jquery-1.5.2.js" type="text/javascript"></script>
<script type="text/javascript">
//隐式迭代:例如当JQuery获取不到ID时不会报错,若javascript获取不到叶,会报错
$(function () {
$(".warning").click(function () {
alert("这是经过信息");
}
);
});
$(function () {
//避免找不到控件ID值但却不报错,可以进行以下错误处理
var e = $("#btn1");
if (e.length <= 0) {
alert("没有找到Btn1");
return;
}
$("#btnOK").mousemove(function () { alert("鼠标移上来了") });
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div class="warning">请携带证件</div>
<p class="warning">请勿碰触</p>
<input class="warning" type="button" id="btnOK" value="点我呀..." />
</div>
</form>
</body>
</html>