jquery 合成事件
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script src="jquery-1.7.1.min.js"></script>
<script>
$(function () {
$('#btnHover').hover(function () {
this.value = "鼠标进入";
}, function () {
this.value = "鼠标离开";
});
$('#btnToggle').toggle(function () {//交替执行
this.value = "第一次点击";
}, function () {
this.value = "第二次点击";
});
$('#btnOne').one('click', function () {//仅执行一次
alert('1');
})
});
</script>
</head>
<body>
<input type="button" name="name" value="hover" id="btnHover" />
<input type="button" name="name" value="toggle" id="btnToggle" />
<input type="button" name="name" value="one" id="btnOne"/>
</body>
</html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script src="jquery-1.7.1.min.js"></script>
<script>
$(function () {
$('#btnHover').hover(function () {
this.value = "鼠标进入";
}, function () {
this.value = "鼠标离开";
});
$('#btnToggle').toggle(function () {//交替执行
this.value = "第一次点击";
}, function () {
this.value = "第二次点击";
});
$('#btnOne').one('click', function () {//仅执行一次
alert('1');
})
});
</script>
</head>
<body>
<input type="button" name="name" value="hover" id="btnHover" />
<input type="button" name="name" value="toggle" id="btnToggle" />
<input type="button" name="name" value="one" id="btnOne"/>
</body>
</html>