<!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元素增加一個邊框? ? ? ? $("input:first").focusin(function() {? ? ? ? ? ? ?$(this).css('border','2px solid red')? ? ? ? })? ? </script>? ? <script type="text/javascript">? ? ? ? //不同函數(shù)傳遞數(shù)據(jù)? ? ? ? function fn(e) {? ? ? ? ? ? ?$(this).val(e.data)? ? ? ? }? ? ? ? function a() {? ? ? ? ? ? $("input:last").click('慕課網(wǎng)', fn)? ? ? ? }? ? ? ? a();? ? </script></body></html>代碼里面不管是focusin改成click事件還是反過來,都是一樣的效果,那兩個事件有什么區(qū)別嗎?
這里focusin和click事一樣的效果啊,請問兩個有什么區(qū)別嗎?
慕仰6432972
2016-09-10 14:46:13