<html>
<head>
<style>
.on{background-color:red;color:yellow}
.off{background-color:yellow;color:red}
</style>
</head>
<body>
<input type="button" onmouseover="this.className='on'" onmouseout="this.className='off'" class="off" value="test">
</body>
</html>

解决方案 »

  1.   

    一楼你的信誉值好高,
    用css我可以自己实现了的,我现在想用js程序实现
      

  2.   

    你看看,希望对你有帮助
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style>
    <!--
    .input1 {
    BACKGROUND-COLOR: #e8e8e8; BORDER-BOTTOM: 
    #a8a8a8 1px solid; BORDER-LEFT: #a8a8a8 1px solid; 
    BORDER-RIGHT: #a8a8a8 1px solid; BORDER-TOP: #a8a8a8 
    1px solid; FONT-SIZE: 9pt
    }
    -->
    </style>
    </head>
    <body bgcolor="#FFFFFF" text="#000000" bgProperties=fixed >
    <p> 
      <input type="button" id="zdd" onclick=javascript:event.srcElement.className="input1" name="Button"  value="Button1">
      <input type="button"  name="Button" value="Button2" onclick=javascript:document.all.zl.className=(document.all.zl.className=="input1")?'':'input1'>
      <input type="button" name="Button" value="Button3" onclick="javascript:document.all.zdd.style.display=(document.all.zdd.style.display =='none')?'':'none'">
      <input type="button"  name="Button" value="Button4" onclick=javascript:this.className=(this.className=="input1")?'':'input1'>
      <input type="button" id="zl" name="Button5" value="Button5">
      <input type="submit" name="Submit" value="Submit" class="input1">
    </p>
    </body>
    </html>
      

  3.   


    <html>
    <head>
    <script language="JavaScript">
    <!--
    var bg;
    function on(o){
    bg=o.currentStyle.backgroundColor
    o.style.backgroundColor='red'
    }
    function off(o){
    o.style.backgroundColor=bg
    }
    //-->
    </script>
    </head>
    <body>
    <input type="button" onmouseover="on(this)" onmouseout="off(this)" style="background-color:yellow" value="test">
    </body>
    </html>
      

  4.   

    <script>
    <!--
    function change(color){
    var el=event.srcElement
    if (el.tagName=="INPUT"&&el.type=="button")
    event.srcElement.style.backgroundColor=color
    }
    //-->
    </script>
    <input onMouseover="change('blue')" onMouseout="change('')" type="button" value="按钮">