案例:JavaScript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function myFunction(x)
6
{
7
x.style.background="yellow";
8
}
9
</script>
10
</head>
11
<body>
12
13
请输入英文字符:<input type="text" onfocus="myFunction(this)">
14
15
<p>当输入字段获得焦点时,会触发改变背景颜色的函数。</p>
16
17
</body>
18
</html>
19