onfocus是放在form里面还是放在select里面,谁能详细解释下?谢谢
ps:我放在select里面网页就一直跳出弹窗,根本停不下来QAQ
我也是这个问题
<!DOCTYPE HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> 光标聚焦事件 </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>
请选择您的职业:<br>
<form>
<select name="career" onfocus="message()" onblur="message1()" id="new1">
<option>学生</option>
<option>教师</option>
<option>工程师</option>
<option>演员</option>
<option>会计</option>
</select>
</form>
</body>
</html>