改变文本框的文本颜色
- <html>
- <head>
- <script type="text/javascript">
- function newColor(color)
- {
- document.getElementById('x').style.color=color
- }
- </script>
- </head>
- <body>
-
- <p>本例演示如何改变 textarea 的文本颜色。</p>
- <p>请把鼠标移动到下面的三个表格单元上,文本颜色将会改变:</p>
-
- <table width="100%"><tr>
- <td bgcolor="red" onmouseover="newColor('red')"> </td>
- <td bgcolor="blue" onmouseover="newColor('blue')"> </td>
- <td bgcolor="green" onmouseover="newColor('green')"> </td>
- </tr></table>
-
- <form>
- <textarea id="x" rows="5" cols="20">
- This example can not be edited
- because our editor uses a textarea
- for input,
- and your browser does not allow
- a textarea inside a textarea.