<input type="button" text="click me" onmouseover="this.runtimeStyle.backgroundColor=red" onmouseout="this.runtimeStyle.backgroundColor=''">

解决方案 »

  1.   

    我是问在CSS文件中该怎么写??
      

  2.   

    我是问在CSS文件中该怎么写??
    >>寫不了
      

  3.   

    好象用htc能实现啊!有谁用过?
      

  4.   

    下面是用HTC实现的:htc 文件内容:
    /////////////////////////
    /// file name : c.htm
    ////////////////////////
    <public:component>
    <public:attach event="onmouseover" onevent="m_over()" />
    <public:attach event="onmouseout" onevent="m_out()" /><script language="jscript">
    function m_over()
    {
    element.runtimeStyle.backgroundColor = "yellow";
    }function m_out()
    {
    element.runtimeStyle.backgroundColor = "";
    }
    </script>
    </public:component>下面是个 html 文件的内容:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <style type="text/css">
    .b
    {
    behavior:url(c.htc);
    }
    </style>
    </HEAD><BODY>
    <input type="button" value="click me" class="b">
    </BODY>
    </HTML>把两个文件保存在同一个目录下面。