用JS实现页面背景转换

来源:互联网 发布:单片机串口线 编辑:程序博客网 时间:2024/05/17 23:35

<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script  language="javascript">

 function bianse(yanse)
 {
  //document.bgColor="red";
  if(yanse=="red")
  {
   document.bgColor="red";
   }
   else
  if(yanse=="Green")
   {
   document.bgColor="Green";
   }
   else
   if(yanse=="Yellow")
   {
   document.bgColor="Yellow";
   }
   else
   {
    document.bgColor="";
    }
  }
</script>
</head>

<body >

<span  onmousemove="bianse('red')" >变红色</span>|

<span onmousemove="bianse('Green')">变绿色</span>|

<span onmousemove="bianse('Yellow')">变黄色</span>|

<span onmousemove="bianse('')">变白色</span>

 

</body>
</html>

原创粉丝点击