改变下拉列表的背景颜色
- <html>
- <head>
- <script type="text/javascript">
- function changeColor(color)
- {
- myForm.elements[0].style.background=color
- }
- </script>
- </head>
- <body>
-
- <p>本例演示如何改变选项列表的背景颜色。</p>
- <p>请把鼠标移动到下面的三个表格单元上,背景颜色将会改变:</p>
-
- <table width="100%"><tr>
- <td bgcolor="red" onmouseover="changeColor('red')"> </td>
- <td bgcolor="blue" onmouseover="changeColor('blue')"> </td>
- <td bgcolor="green" onmouseover="changeColor('green')"> </td>
- </tr></table>
-
- <form name="myForm">
- <select>
- <option>请把鼠标移动到颜色上面</option>
- <option>请把鼠标移动到颜色上面</option>
- <option>请把鼠标移动到颜色上面</option>
- <option>请把鼠标移动到颜色上面</option>
- </select>
- </form>
-
- </body>
- </html>