ndr-itsolutions
asked on
Greyed Out Text and ASP.net
I would like to, have greyed out text in a textBox when the web application starts. When someone clicks on the textBox I would like the greyed out text to be removed so that they can type, and if they leave the textBox, I would like this greyed out text to return.
How can I achieve this in Web developer Express, using VB ?
Thanks
How can I achieve this in Web developer Express, using VB ?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just use a javascript on onchange event at the text box
example:
<asp:TextBox ID="TextBox1" runat="server" onchange="ChangeColor()" ></asp:TextBox>
the javascript function will look like this
<script language="javascript" type="text/javascript">
function ChangeColor()
{TextBox1= "<%=TextBox1.ClientID %>"
document.getElementById(Te xtBox1).st yle.color= 'grey'
}
</script>
example:
<asp:TextBox ID="TextBox1" runat="server" onchange="ChangeColor()" ></asp:TextBox>
the javascript function will look like this
<script language="javascript" type="text/javascript">
function ChangeColor()
{TextBox1= "<%=TextBox1.ClientID %>"
document.getElementById(Te
}
</script>
Open in new window