Passing a field to javascript and evaluate
<p>I have a web form with several text boxes.  I want to evaluate the default value in a text box and when user clicks on the field I want to clear it out.  This is helping to reduce space on a form. </p>

<p>The below gives error message "Microsoft JScript Runtime error: object required.</p>

<p>Javascript:</p>

<pre><code>function validateKeyword(f, flg, val) {
    switch (flg) {
        case 0: if (document.getElementById(f).value == val) { document.getElementById(f).value = ''; } break;
        case 1: if (document.getElementById(f).value == '') { document.getElementById(f).value = val; } break;
    }
}
</code></pre>

<p>ASP.NET textbox:</p>

<pre><code>&lt;asp:TextBox maxlength="150"  runat="server" name="First_Name" value="First Name" class="frmsel2" onfocus="javascript:validateKeyword('first_name',0,'First Name');" onblur="javascript: validateKeyword('first_name',1,'First Name');" alt="First Name" title="First Name" id="first_name"&gt;&lt;/asp:TextBox&gt;
</code></pre>
