<li style="margin-top: 10px;">
                <asp:TextBox ID="tbxVname" runat="server" Width="166" Height="13" onFocus="this.value='';"></asp:TextBox>
            </li>
            <li style="margin-top: 10px; margin-bottom: 10px;">
                <asp:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" />
            </li>有没什么方法在onFocus="this.value='';"里面加个颜色设置?类似onFocus="this.value='';this.color='red'"这样的

解决方案 »

  1.   

    <input type="textbox" onFocus="this.style.color='red'"/>
      

  2.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head><body>
        <form id="form1" runat="server">
            <input type="text" onblur="this.style.color='red';this.value='你好!'" />
        </form>
    </body>
    </html>
      

  3.   

    <input id="Text1" type="text" onfocus="this.style.color='red'" onblur="this.style.color='black'" />
      

  4.   


    <input id="Text1" type="text" onfocus="this.style.color='red'" onblur="this.style.color='black'" />
    为什么写到js 里面将一个css给这个事件的时候就显示不出来了呢??例如:<input id="Text1" type="text" onfocus="fnFocus()" onblur="this.style.color='black'" />
    function fnFocus()
    {
      document.getelementById("Text1").className="aa";
    }
    <style type="css">
    aa{ color:red;}
    </style>
    不知道各位试过没有,还是我写的有问题呀,
    借楼主的机会也问一下下!!!
      

  5.   


    <input id="Text1" type="text" onfocus="fnFocus()" onblur="this.style.color='black'" />
    function fnFocus()
    {
      document.getelementById("Text1").className="aa";
    }
    <style type="css">
    .aa{ color:red;}
    </style>回复5楼,是你的样式写的不对,你可以想想看我们在用class='aa'的时候,类别选择器应该是'.aa'吧