I am facing very strange problem with below javascript. Compiler throw the error on line 39 of textbox code but it is very correct don’t know why this happen?.
<script type="text/javascript">
function WaterMark(txtName, event) {
var defaultText = "Enter Username Here";
// Condition to check textbox length and event type
if (txtName.value.length == 0 & event.type == "Load") {
//if condition true then setting text color and default text in textbox
txtName.style.color = "Gray";
txtName.value = defaultText;
}
// Condition to check textbox value and event type
if (txtName.value == defaultText & event.type == "TextChanged") {
txtName.style.color = "black";
txtName.value = "";
}
}
<table id="Search"><tr><td>
<cc1:ToolkitScriptManager ID="TKit" runat="server"></cc1:ToolkitScriptManager>
<asp:TextBox ID="Tbox" runat="server" Width="300" OnLoad="WaterMark(this,event);" OnTextChanged ="WaterMark(this,event);" ></asp:TextBox>
<cc1:AutoCompleteExtender
ID="Atx"
TargetControlID="Tbox"
runat="server"
UseContextKey="True"
MinimumPrefixLength="1"
EnableCaching="true"
CompletionSetCount="1"
CompletionInterval="1000"
ServiceMethod="location"
CompletionListCssClass ="MM">
</cc1:AutoCompleteExtender>
</td></tr><tr><td>
How to overcome what is the solution for this?.!