water mark in asp.net webpage using javascript

Hariinakoti
Posted by Hariinakoti under JavaScript category on | Points: 40 | Views : 1454
<script type="text/javascript">
function Watermark()
{
var txt=document.getElementById("TextBox1").value;
if(txt=="Enter User Name")
{
document.getElementById("TextBox1").value="";
}

}
function RemoveWatermark()
{
var txt=document.getElementById("TextBox1").value;
if(txt=="")
{
document.getElementById("TextBox1").value="Enter User Name";
}

}
</script>

<div>
<asp:TextBox ID="TextBox1" Text="Enter User Name" onblur="return RemoveWatermark()" onfocus="return Watermark()" runat="server"></asp:TextBox>
</div>

Comments or Responses

Login to post response