SoFunction
Updated on 2025-03-01

Detailed explanation of the default value processing of JS text box


<script type="text/javascript">
       function txtFocus(el) {
           if ( == ) { = ''; = '#000'; }
       }

       function txtBlur(el) {
           if ( == '') { = ; = '#666'; }
       }
    </script>

<asp:TextBox ID="txtBookPerson" runat="server" CssClass="text2" style="color:#666;" onfocus="txtFocus(this)" onblur="txtBlur(this)" value='Please enter the reservation' ></asp:TextBox>