求解這個(gè)e是什么意思,我知道是事件對(duì)象
<!DOCTYPE html>
<html>
<head>
? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
? ? <title></title>
? ? <style>
? ? .left div,
? ? .right div {
? ? ? ? width: 350px;
? ? ? ? height: 150px;
? ? ? ? padding: 5px;
? ? ? ? margin: 5px;
? ? ? ? border: 1px solid #ccc;
? ? }
? ? p{
? ? ? ? height: 50px;
? ? ? ? border: 1px solid red;
? ? ? ? margin: 30px;
? ? }
? ? .left div {
? ? ? ? background: #bbffaa;
? ? }
? ? .right div {
? ? ? ? background: yellow;
? ? }
? ? </style>
? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
? ? <h2>mouseover與mouseout事件</h2>
? ? <h4>測(cè)試一</h4>
? ? <button>點(diǎn)擊:指定觸發(fā)mouseover事件</button>
? ? <script type="text/javascript">
? ? ? ? $('h2').mouseover(function(e) {
? ? ? ? ? ? alert('觸發(fā)h2元素綁定的mouseover')
? ? ? ? })
? ? ? ? $("button:eq(0)").click(function(e) {
? ? ? ? ? ? $('h2').mouseover() //指定觸發(fā)綁定的事件
? ? ? ? })
? ? </script>
? ??
? ??
? ? <h4>測(cè)試二</h4>
? ? <div class="left">
? ? ? ? <div class="aaron1">
? ? ? ? ? ? <p>鼠標(biāo)移進(jìn)此區(qū)域觸發(fā)mouseover事件</p>
? ? ? ? ? ? <a>進(jìn)入元素內(nèi)部,mouseover事件觸發(fā)次數(shù):</a>
? ? ? ? </div>
? ? </div>
? ? <script type="text/javascript">
? ? ? ? var n = 0;
? ? ? ? //綁定一個(gè)mouseover事件
? ? ? ? $(".aaron1 p:first").mouseover(function(e) {
? ? ? ? ? ? $(".aaron1 a").html('進(jìn)入元素內(nèi)部,mouseover事件觸發(fā)次數(shù):' + (++n))
? ? ? ? })
? ? </script>
? ??
? ??
? ? <h4>測(cè)試三</h4>
? ? <div class="right">
? ? ? ? <div class="aaron2">
? ? ? ? ? ? <p>鼠標(biāo)移動(dòng):不同函數(shù)傳遞數(shù)據(jù)</p>
? ? ? ? ? ? <a>進(jìn)入元素內(nèi)部,mouseover事件觸發(fā)次數(shù):</a>
? ? ? ? </div>
? ? </div>
? ? <br/>
? ? <script type="text/javascript">
? ? ? ? var n = 0;
? ? ? ? //不同函數(shù)傳遞數(shù)據(jù)
? ? ? ? function data(e) {
? ? ? ? ? ? $(".right a").html('mouseover事件觸發(fā)次數(shù):' + (++n) + '<br/> 傳入數(shù)據(jù)為 :'+ e.data)
? ? ? ? }
? ? ? ? function a() {
? ? ? ? ? ? $(".right p:first").mouseover('data = 慕課網(wǎng)', data)
? ? ? ? }
? ? ? ? a();
? ? </script>
</body>
</html>
2016-08-09
當(dāng)然是傳入函數(shù)里的數(shù)據(jù)啦
2016-08-08
傳遞的參數(shù)