I’m newer in JavaScript.So maybe my question will seem naive.
My JavaScript Code:
<script type = "text/javascript">
var defaultText = "Enter your text here";
function WaterMark(txt, evt)
{
if(txt.value.length == 0 && evt.type == "blur")
{
txt.style.color = "gray";
txt.value = defaultText;
}
if(txt.value == defaultText && evt.type == "focus")
{
txt.style.color = "black";
txt.value="";
}
}
ASP declaration:
<asp:TextBox ID="TextBox1" runat="server" Text = "Enter your text here
ForeColor = "Gray"
onblur = "WaterMark(this, event);"
onfocus = "WaterMark(this, event);">
My quetstion is about parameters of this two events:
onblur = "WaterMark(this, event);"
onfocus = "WaterMark(this, event);"
If i understood correctly word this means the current control.
And what is meaning of the second parameter, event ?
Thank you in advance!
Those are the event arguments, or
EventArgs. They can contain a set of variables that existed at the time the event was created, to provide additional context to the event handler. It’s basically a way to pass information into your event handler.http://pietschsoft.com/post/2008/11/07/ASPNET-AJAX-Create-a-JavaScript-Component-with-Events.aspx