2 回答

前端小菜鸟呀
TA贡献1条经验 获得超0个赞
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="../js/jquery-2.1.4.js" ></script>
</head>
<body>
<input type="text" id="a"/>
<script type="text/javascript">
$(function(){
$("#a").focus(function(){
$(this).css("background-color","bisque")
})
});
</script>
</body>
</html>

代码写的比较菜
TA贡献2条经验 获得超0个赞
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(function(){ $("#a").onfocus(){ alert("获得焦点"); } }); </script> </head> <body> <input type="text" id="a"/> </body> </html>
添加回答
举报
0/150
提交
取消