请问我怎样可以做到单击页面里某一个文本框他的底色就会变成黄色,其它的就恢复到正常色(白色)

解决方案 »

  1.   

    <tr style=cursor:hand onMouseOver=this.style.backgroundColor='#DCF1E0' onMouseOut=this.style.background='#FFFFFF'>
      

  2.   

    <asp:textbox id="textbox1" onfocus="a()" onblur="b()">
    <script language="c#">
    public void a(object ...)
    {
    textbox1.forcecolor="#******";
    }
    public void b(object ...)
    {
    textbox1.forcecolor="#******";
    }
    </script>
      

  3.   

    shoushii(守矢)有JAVASCRIPT的吗,你这个好像是C#做的
      

  4.   

    改变对象的className就可以实现了<style>
    .ccc{bgcolor:yellow}
    obj.className="ccc";就Ok了http://www.lbsxp.com
      

  5.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    input {changeColor:expression(onfocus=function(){changeColor(this)});restoreColor:expression(onblur=function(){restoreColor(this)});}
    </style></head><body>
    <form id="form1" name="form1" method="post" action="">
      <label>
      <input type="text" name="textfield"  />
      </label>
      <label>
      <input type="text" name="textfield2" />
      </label>
    </form></body>
    </html>
    <script language="javascript">     function changeColor(obj)
    {
     
    obj.style.backgroundColor="yellow"

         
     }
     
     function restoreColor(obj)
    {
     
    obj.style.backgroundColor="";

         
     }
     
     </script>
      

  6.   

    哈好久没用css批量控制样式了,顺便用用这个复习一下,兄弟可以参考一下的,当然未必要用这种css批量控制的方法啊
      

  7.   

    如果做一个通用的放在一个CSS里可以吗