課程
/前端開發(fā)
/JavaScript
/JavaScript進(jìn)階篇
onfocus是放在form里面還是放在select里面,誰能詳細(xì)解釋下?謝謝
ps:我放在select里面網(wǎng)頁就一直跳出彈窗,根本停不下來QAQ
2016-04-17
源自:JavaScript進(jìn)階篇 6-5
正在回答
我也是這個問題
<!DOCTYPE HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 光標(biāo)聚焦事件 </title>
? <script type="text/javascript">
? ? function message(){
var new2=document.getElementById("new1");
? ? ?new2.style.backgroundColor="pink";
}
? ? function message1(){
? ? ? ? var new3=document.getElementById("new1");
? ? ? ?// new3.style.backgroundColor="purple";
? ? ? ?new3.removeAttribute("style");
? ? }
? </script>
</head>
<body>
請選擇您的職業(yè):<br>
? <form>
? ? <select name="career" onfocus="message()" onblur="message1()" id="new1">?
? ? ? <option>學(xué)生</option>?
? ? ? <option>教師</option>?
? ? ? <option>工程師</option>?
? ? ? <option>演員</option>?
? ? ? <option>會計</option>?
? ? </select>?
? </form>
</body>
</html>
俠客島的含笑
舉報
本課程從如何插入JS代碼開始,帶您進(jìn)入網(wǎng)頁動態(tài)交互世界
1 回答在6-5中要把onfocus函數(shù)放在哪里?
2 回答求幫看下,到底哪兒錯了?
3 回答到底哪兒出錯了啊~~~~(>_<)~~~~
2 回答onfocus與onclick的區(qū)別到底是什么?
2 回答應(yīng)該放在13行代碼
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-07-13
我也是這個問題
2016-04-17
<!DOCTYPE HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 光標(biāo)聚焦事件 </title>
? <script type="text/javascript">
? ? function message(){
var new2=document.getElementById("new1");
? ? ?new2.style.backgroundColor="pink";
}
? ? function message1(){
? ? ? ? var new3=document.getElementById("new1");
? ? ? ?// new3.style.backgroundColor="purple";
? ? ? ?new3.removeAttribute("style");
? ? }
? </script>
</head>
<body>
請選擇您的職業(yè):<br>
? <form>
? ? <select name="career" onfocus="message()" onblur="message1()" id="new1">?
? ? ? <option>學(xué)生</option>?
? ? ? <option>教師</option>?
? ? ? <option>工程師</option>?
? ? ? <option>演員</option>?
? ? ? <option>會計</option>?
? ? </select>?
? </form>
</body>
</html>