当前位置: 洪哥笔记 > DHTML > DHTML实例

 

DHTML实例


关键词

css 背景颜色的改变 代码

摘要

通过写代码来控制文本的背景颜色
<html>

<head>


<script type="text/javascript">
function bgChange(bg)
{
document.body.style.background=bg
}
</script>
</head>

<body>

<b>请把鼠标移动到正方形上,背景颜色会发生改变!</b>

<table width="300" height="100">
 <tr>
  <td onmouseover="bgChange('red')" 
      onmouseout="bgChange('transparent')"
      bgcolor="red">
  </td>
  <td onmouseover="bgChange('black')" 
      onmouseout="bgChange('transparent')"
      bgcolor="black">
  </td>
  <td onmouseover="bgChange('green')" 
      onmouseout="bgChange('transparent')"
      bgcolor="green">
  </td>
</tr>
</table>

</body>
</html>

 

要饭二维码

洪哥写文章很苦逼,如果本文对您略有帮助,可以扫描下方二维码支持洪哥!金额随意,先行谢过!大家的支持是我前进的动力!

文章的版权

本文属于“洪哥笔记”原创文章,转载请注明来源地址:DHTML实例:http://www.splaybow.com/post/dhtml-example-1.html

如果您在服务器运维、网络管理、网站或系统开发过程有需要提供收费服务,请加QQ:8771947!十年运维经验,帮您省钱、让您放心!
亲,如果有需要,先存起来,方便以后再看啊!加入收藏夹的话,按Ctrl+D

« 表单的设计 改变图像的尺寸 »