案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function color(color)
5
{
6
document.forms[0].myInput.style.background=color
7
}
8
</script>
9
</head>
10
11
<body>
12
13
<form>
14
请编写一条消息:<br />
15
<input
16
type="text" 
17
onkeydown="color('red')"
18
onkeyup="color('blue')"
19
name="myInput" size="20">
20
</form>
21
22
</body>
23
</html>
24