為什么‘慕課網(wǎng)’是指向e.date???
<!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" />
??????? </div>
??? </div>
??? <div class="right">
??????? <div class="aaron1">
??????????? 點(diǎn)擊聚焦并傳遞參數(shù):<input type="text" />
??????? </div>
??? </div>
??? <script type="text/javascript">
??????? //input聚焦
??????? //給input元素增加一個(gè)邊框
??????? $("input:first").focusin(function() {
???????????? $(this).css('border','2px solid red')
??????? })
??? </script>
??? <script type="text/javascript">
??????? //不同函數(shù)傳遞數(shù)據(jù)
??????? function fn(a) {
???????????? $(this).val(a.data)
??????? }
??????? function a() {
??????????? $("input:last").focusin('慕課網(wǎng)', fn)
??????? }
??????? a();
??? </script>
</body>
</html>
2016-12-11
focusin(參數(shù)1,參數(shù)2),參數(shù)一是你要傳遞的數(shù)據(jù),參數(shù)二是你將數(shù)據(jù)傳遞給的函數(shù)a,函數(shù)a的第一個(gè)參數(shù)是event對(duì)象,他的屬性data的值就是你傳遞的數(shù)據(jù),即參數(shù)1,我是這么理解的,希望對(duì)你有所幫助。