第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

這里是 function data(e) 事件是怎么觸發(fā)的?

<!DOCTYPE html>

<html>


<head>

? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />

? ? <title></title>

? ? <style>

? ? .test2 {

? ? ? ? background: #bbffaa;

? ? }

? ? .test3 {

? ? ? ? background: yellow;

? ? }

? ? .test2,.test3{

? ? ? ? border: 1px solid red;

? ? }

? ? </style>

? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>

</head>


<body>

? ? <h2>.click()方法</h2>


? ? <h4>測(cè)試一</h4>

? ? <button>元素綁定事件,彈出回調(diào)中的this</button>

? ? <script type="text/javascript">

? ? ? ? //this指向button元素

? ? ? ? ?$("button:eq(0)").click(function() {

? ? ? ? ? ? alert(this)

? ? ? ? })

? ? </script>




? ? <h4>測(cè)試二</h4>

? ? <div class="test2">

? ? ? ? <p>$('button:first').click(function(e) {alert(this)})</p>

? ? </div>

? ? <button>指定觸發(fā)事件</button>

? ? <script type="text/javascript">

? ? ? ? $('p').click(function(e) {

? ? ? ? ? ? alert(e.target.textContent)

? ? ? ? })

? ? ? ? //this指向button元素

? ? ? ? $("button:eq(1)").click(function() {

? ? ? ? ? ? $('p').click() //指定觸發(fā)綁定的事件

? ? ? ? })

? ? </script>




? ? <h4>測(cè)試三</h4>

? ? <div class="test3">

? ? ? ? <p>$('.right').click(1111, set)</p>

? ? </div>


? ? <button>不同函數(shù)傳遞數(shù)據(jù)</button>

? ? <script type="text/javascript">

?function data(e) {

? ? ? ? ? ? alert(e.data) //1111

? ? ? ? }


? ? ? ? function a() {

? ? ? ? ? ? //傳值

? ? ? ? ? ? $("button:eq(2)").click(1111, data)

? ? ? ? }

? ? ? ? a();


? ? </script>





</body>


</html>



?function data(e) {

? ? ? ? ? ? alert(e.data) //1111

? ? ? ? }


? ? ? ? function a() {

? ? ? ? ? ? //傳值

? ? ? ? ? ? $("button:eq(2)").click(1111, data)

? ? ? ? }

? ? ? ? a();


正在回答

1 回答

每一個(gè)<button></button>元素下對(duì)應(yīng)的<script>里面定義的

?function a() {

? ? ? ? ? ? //傳值

? ? ? ? ? ? $("button:eq(i)").click(1111, data)

? ? ? ? }

就是為每一個(gè)對(duì)應(yīng)的button綁定了一個(gè)點(diǎn)擊函數(shù),比如$("button:eq(0)")就是第一個(gè)按鈕,?$("button:eq(1)")就是第二個(gè)按鈕等等,他們是通過(guò)點(diǎn)擊按鈕后觸發(fā)的

1 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_沼鈴_0 提問(wèn)者

非常感謝!
2017-02-08 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

這里是 function data(e) 事件是怎么觸發(fā)的?

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)