案例:HTML DOM案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function newColor(color)
5
{
6
document.getElementById('x').style.color=color
7
}
8
</script>
9
</head>
10
<body>
11
12
<p>本例演示如何改变 textarea 的文本颜色。</p>
13
<p>请把鼠标移动到下面的三个表格单元上,文本颜色将会改变:</p>
14
15
<table width="100%"><tr>
16
<td bgcolor="red" onmouseover="newColor('red')"> </td>
17
<td bgcolor="blue" onmouseover="newColor('blue')"> </td>
18
<td bgcolor="green" onmouseover="newColor('green')"> </td>
19
</tr></table>
20
21
<form>
22
<textarea id="x" rows="5" cols="20">
23
This example can not be edited
24
because our editor uses a textarea
25
for input,
26
and your browser does not allow
27
a textarea inside a textarea.
28
</textarea>
29
</form>
30
31
</body>
32
</html>
33