date(e)是什么意思,a又是哪里來的,click(1111,data)這一局這樣寫代表什么
<h4>測試三</h4>
??? <div class="test3">
??????? <p>$('.right').click(1111, set)</p>
??? </div>
??? <button>不同函數(shù)傳遞數(shù)據(jù)</button>
??? <script type="text/javascript">
??????? //不同函數(shù)傳遞數(shù)據(jù)
??????? function data(e) {
??????????? alert(e.data) //1111
??????? }
??????? function a() {
??????????? $("button:eq(2)").click(1111, data)
??????? }
??????? a();
??? </script>
2016-11-17
1、data()是定義的一個函數(shù),函數(shù)名是data,e是其中的參數(shù);
2、a()也是定義的一個函數(shù),函數(shù)名是a;
3、click(1111,data),其中1111是e.data對應的實參,data其實就是代表執(zhí)行函數(shù)data(),當執(zhí)行a()函數(shù),會彈窗的值就是“1111”。
2016-12-13
我試了一下 把a函數(shù)去掉
// function a() {
? ? ? ? ? ? $("button:eq(2)").click(1111, data)
? ? ? ? // }
? ? ? ? // a();
直接執(zhí)行點擊事件 也是可以的?這里的$("button:eq(2)").click(1111, data)data就是執(zhí)行上面的data函數(shù)的意思