Some options on the asp.net page are prompted for judgment. For example, when saving a piece of information, you need to judge whether the current information is empty. The following two conditions are described. Use the ext control and asp control for analysis. if it is an asp control, you must obtain the id of the current control when prompted. You can obtain the id of the corresponding option by querying the source code. 2. If it is an ext control, prompt a certain option to directly obtain the id of the control in the aspx design. Use the following js functions to prompt. <Script language = "javascript"> function YANDNCheck () {if (document. getElementById ("txtName ")! = Null) {if (document. getElementById ("txtName"). value = "") {alert ('name cannot be blank! '); Document. getElementById ("txtName "). focus (); return false ;}}return true ;}</script> 1: Judgment information of the asp control <script language = "javascript"> function YANDNCheck () {if (document. getElementById ("the current textbox id in the source code ")! = Null) {if (document. getElementById ("Current textbox id in source code"). value = "") {alert ('name cannot be blank! '); Document. getElementById ("the current textbox id in the source code "). focus (); return false ;}}return true ;}</script> front-end display of the asp control <table> <tr> <td> Name: </td> <asp: TextBox id = "txtName"/> <td> <asp: Button onClientClick = "return YANDNCheck (); "/> </tr> </table> type 2: ext control judgment Information <script language =" javascript "> function YANDNCheck () {if (document. getElementById ("txtName ")! = Null) {if (document. getElementById ("txtName"). value = "") {alert ('name cannot be blank! '); Document. getElementById ("txtName "). focus (); return false ;}}return true ;}</script> ext control foreground display information: you can directly call the id of the corresponding control <table> <tr> <td> name: </td> <ext: textBox id = "txtName"/> <td> <ext: Button onClientClick = "return YANDNCheck ();"/> </tr> </table>