① During Web development, you may also encounter problems that I encountered before. When using the TextBox Control, the edge of the control cannot be completely overwritten by the background image. 1:
After Textbox resolution, it is also an html-Text control, while the Text control has edges by default, that is, border: 1px solid #000;
Therefore, you only need to add the following small CSS for the Textbox Control, that is, "border: 0px", and the final effect is 2:
② When you are doing Web development, I wonder if you have found that when TextMode = "MultiLine" of the Textbox Control is replaced, MaxLength has actually expired.
When the TextMode attribute of Textbox is "MultiLine", it is actually the html-textarea control after parsing. This html control does not have the MaxLength attribute.
If you want to limit the input length, you can set the following attributes:
<Asp: TextBox ID = "maid" runat = "server" TextMode = "MultiLine" onkeyup = "this. value = this. value. slice (0, 1000)">
③ When you make some input boxes, you may want to trigger an event when you get the focus, or trigger an event when you lose focus:
I wrote two JS files to meet the following requirements:Copy codeThe Code is as follows: <script type = "text/javascript">
// Triggered when the focus is obtained
Function onFocusFun (element, elementValue ){
If (element. value = elementValue ){
Element. value = "";
Element. style. color = "";
}
}
// Triggered when the input box is left.
Function onblurFun (element, elementValue ){
If (element. value = ''){
Element. style. color = "#808080 ";
Element. value = elementValue;
}
}
</Script>
Then, you can reference them in the Textbox Control as follows:Copy codeThe Code is as follows: <asp: TextBox ID = "reply_note" runat = "server" Text = "post reply, the number of words entered is limited to 1000 words "ForeColor =" #808080 "OnFocus =" onFocusFun (this, 'Post reply, the number of words entered is limited to 1000 words ')"
OnBlur = "onblurFun (this, 'Post reply, up to 1000 words')"> </asp: TextBox>
This is one of the tips I have developed recently. I may have already written a similar article on the Internet. However, I personally think these methods are simple and easy to understand. I hope they can help you.
If you have other tips, you can leave a message.