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

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

如何多次實(shí)現(xiàn)點(diǎn)擊聚焦并傳遞參數(shù)?

<!DOCTYPE html>

<html>


<head>

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

? ? <title></title>

? ? <style>

? ? .left div,

? ? .right div {

? ? ? ? width: 500px;

? ? ? ? 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>.focusin()方法</h2>

? ? <div class="left">

? ? ? ? <div class="aaron">

? ? ? ? ? ? 點(diǎn)擊聚焦:<input type="text" />

? ? ? ? ? ? <br>

? ? ? ? ? ? 點(diǎn)擊聚焦:<input type="text" />

? ? ? ? </div>


? ? </div>

? ? <div class="right">

? ? ? ? <div class="aaron1">

? ? ? ? ? ? 點(diǎn)擊聚焦并傳遞參數(shù):<input type="text" />

? ? ? ? ? ? <br>

? ? ? ? ? ? 點(diǎn)擊聚焦并傳遞參數(shù):<input type="text" />

? ? ? ? </div>

? ? ? ??

? ? </div>



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


? ? ? ? //input聚焦

? ? ? ? //給input元素增加一個(gè)邊框

? ? ? ? $("input:last-child").focusin(function() {

? ? ? ? ? ? ?$(this).css('border','12px solid red')

? ? ? ? })

? ? ? ??

? ? ? ? //D

? ? ? ? $("input:first").focusin(function(){

? ? ? ? ? ? $(this).css('border',"12px solid green")

? ? ? ? })

? ? </script>



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


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

? ? ? ? function fn(e) {

? ? ? ? ? ? ?$(this).val(e.data)

? ? ? ? }


? ? ? ? function a() {

? ? ? ? ? ? $('input:first-child.focusin('慕課網(wǎng)', fn)

? ? ? ? }

? ? ? ? a();

? ??

? ? ? ? //DIY

? ? ? ? function fn(e){

? ? ? ? ? ? $(this).val(e.data)

? ? ? ? }

? ? ? ??

? ? ? ? function a(){

? ? ? ? ? ? $("input:last-child").focusin("請(qǐng)輸入密碼",fn)

? ? ? ? }

? ? ? ? a();

? ? </script>

</body>


</html>


黑體是我自己增加的,為什么這時(shí)候第一個(gè)框就無(wú)法實(shí)現(xiàn)點(diǎn)擊聚焦并傳遞參數(shù)了?


正在回答

2 回答

<!DOCTYPE html>

<html>


<head>

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

? ? <title></title>

? ? <style>

? ? .left div,

? ? .right div {

? ? ? ? width: 500px;

? ? ? ? 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>.focusin()方法</h2>

? ? <div class="left">

? ? ? ? <div class="aaron">

? ? ? ? ? ? 點(diǎn)擊聚焦:<input type="text" />

? ? ? ? ? ? <br>

? ? ? ? ? ? 點(diǎn)擊聚焦:<input type="text" />

? ? ? ? </div>


? ? </div>

? ? <div class="right">

? ? ? ? <div class="aaron1">

? ? ? ? ? ? 點(diǎn)擊聚焦并傳遞參數(shù):<input type="text" />

? ? ? ? ? ? <br>

? ? ? ? ? ? 點(diǎn)擊聚焦并傳遞參數(shù):<input type="text" />

? ? ? ? </div>

? ? ? ??

? ? </div>



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


? ? ? ? //input聚焦

? ? ? ? //給input元素增加一個(gè)邊框

? ? ? ? $("input:eq(1)").focusin(function() {

? ? ? ? ? ? ?$(this).css('border','1px solid red')

? ? ? ? })

? ? ? ??

? ? ? ? //D

? ? ? ? $("input:eq(0)").focusin(function(){

? ? ? ? ? ? $(this).css('border',"1px solid green")

? ? ? ? })

? ? </script>



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


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

? ? ? ? function fn(e) {

? ? ? ? ? ? ?$(this).val(e.data)

? ? ? ? }


? ? ? ? function b() {

? ? ? ? ? ? $("input:eq(2)").focusin("慕課網(wǎng)", fn)

? ? ? ? }

? ? ? ? b();

? ??

? ? ? ? //DIY

? ? ? ? function fn(e){

? ? ? ? ? ? $(this).val(e.data)

? ? ? ? }

? ? ? ??

? ? ? ? function a(){

? ? ? ? ? ? $("input:eq(3)").focusin("請(qǐng)輸入密碼",fn)

? ? ? ? }

? ? ? ? a();

? ? </script>

</body>


</html>


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

12只怕有心人 提問者

非常感謝!
2016-10-13 回復(fù) 有任何疑惑可以回復(fù)我~

自己對(duì)比了下兩段代碼發(fā)現(xiàn)如下

1.首先選擇器last和last child,first和first child是不一樣的

????四個(gè)input分別為eq(0)-(3)

????在點(diǎn)擊聚焦和點(diǎn)擊聚焦并傳遞參數(shù)的2段代碼中,

????如果用

?????$("input:last")作為選擇器,結(jié)果只改變了eq(3)

?????$("input:last-child")作為選擇器,改變eq(1)和eq(3)

?????$("input:first")作為選擇器,結(jié)果只改變了eq(0)

?????$("input:first-child")作為選擇器,改變eq(0)和eq(2)

?????多個(gè)“child"就需要滿足兩個(gè)條件:

???? 被選取input有父元素,而且input是該父元素的第一個(gè)元素

2.//不同函數(shù)傳遞數(shù)據(jù)中兩個(gè)函數(shù)起名不能重復(fù).

3. ?$('input:first-child.focusin('慕課網(wǎng)', fn) 中漏了一個(gè))?

還要再打牢基礎(chǔ).









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

舉報(bào)

0/150
提交
取消

如何多次實(shí)現(xiàn)點(diǎn)擊聚焦并傳遞參數(shù)?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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