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

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

對次數(shù)變量的計(jì)數(shù)不是太理解

因?yàn)槎际莕的話,會(huì)影響測試二的次數(shù)輸出,所以我換成了i,但是這個(gè)次數(shù)的這種計(jì)數(shù)方式不太明白,觸發(fā)類型獲取的是最后觸發(fā)的事件類型,就down和up,次數(shù)應(yīng)該是2次,為什么還要++n呢

正在回答

5 回答

我也想知道為什么顯示的是3

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

直接給你上我的源碼吧哈哈

<!DOCTYPE?html>
<html>

<head>
????<meta?http-equiv="Content-type"?content="text/html;?charset=utf-8"?/>
????<title></title>
????<style>
????????.left?div,
????????.right?div?{
????????????width:?100%;
????????????height:?50px;
????????????padding:?5px;
????????????margin:?5px;
????????????float:?left;
????????????border:?1px?solid?#ccc;
????????}

????????.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>刪除事件</h2>


<h4>測試一</h4>
<div?class="left">
????on('mousedown?mouseup')
????<div?class="aaron">點(diǎn)擊觸發(fā)</div>
</div>
<button>點(diǎn)擊刪除mousedown事件</button>
<script?type="text/javascript">
????var?m?=?0,n=0;
????//綁定事件
????$('.aaron:first').on({
????????mousedown:function?(e)?{
????????????++m;
????????????$(this).text(?'觸發(fā)類型:'?+??(e.type)?+?",次數(shù)"?+?m);
????????},
????????mouseup:function?(e)?{
????????????++n;
????????????$(this).text(?'觸發(fā)類型:'?+??(e.type)?+?",次數(shù)"?+?n);
????????}
????});

????//刪除事件
????$("button:first").click(function()?{
????????$(".aaron:first").off('mousedown')
????})

</script>



<h4>測試一</h4>
<div?class="left">
????on('mousedown?mouseup')
????<div?class="aaron">點(diǎn)擊觸發(fā)</div>
</div>
<button>點(diǎn)擊銷毀所有事件off</button>
<script?type="text/javascript">
????var?i?=?0,j=0;
????//綁定事件
????$('.aaron:last').on({
????????mousedown:function?(e)?{
????????????++i;
????????????$(this).text(?'觸發(fā)類型:'?+??(e.type)?+?",次數(shù)"?+?i);
????????},
????????mouseup:function?(e)?{
????????????++j;
????????????$(this).text(?'觸發(fā)類型:'?+??(e.type)?+?",次數(shù)"?+?j);
????????}
????});

????//刪除事件
????$("button:last").click(function()?{
????????$(".aaron:last").off()
????})

</script>
</body>

</html>


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

樓上+1

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

是啊,我覺得那個(gè)++n是多余的啊


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

觸發(fā)一次就迭加一次,所以不斷的遞增

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

qq_miaomiaodoub_0 提問者

觸發(fā)一次是3,所以有點(diǎn)不理解
2016-10-11 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

對次數(shù)變量的計(jì)數(shù)不是太理解

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

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

幫助反饋 APP下載

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

公眾號

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