The following are divided into two different cases. Analysis by using the Ext control and ASP's controls respectively
1. If it is an ASP's control, you need to get the ID of the current control when you are prompted, and you can get the corresponding option by querying the source code
's ID.
2. If the control is ext, make a prompt for an option to directly get the ID of the control in the ASPX design.
It is prompted by the following JS function.
Copy Code code as follows:
<script language= "JavaScript" >
function Yandncheck () {
if (document.getElementById ("txtname")!= null) {
if (document.getElementById ("Txtname"). Value = = "") {
Alert (' name cannot be empty! ');
document.getElementById ("Txtname"). focus ();
return false;
}
}
return true;
}
</script>
The first: The evaluation information of ASP control
Copy Code code as follows:
<script language= "JavaScript" >
function Yandncheck () {
if (document.getElementById ("ID of the currently corresponding textbox in Source code")!= null) {
if (document.getElementById ("ID of the currently corresponding textbox in Source code"). Value = = "") {
Alert (' name cannot be empty! ');
document.getElementById (ID of the currently corresponding textbox in the source code). focus ();
return false;
}
}
return true;
}
</script>
foreground display of ASP controls
Copy Code code as follows:
<table>
<tr>
<td> name:</td>
<td><asp:textbox id= "Txtname"/>
<td><asp:button onclientclick= "return Yandncheck ();" />
</tr>
</table>
The second type: the Judgment information of ext control
Copy Code code as follows:
<script language= "JavaScript" >
function Yandncheck () {
if (document.getElementById ("txtname")!= null) {
if (document.getElementById ("Txtname"). Value = = "") {
Alert (' name cannot be empty! ');
document.getElementById ("Txtname"). focus ();
return false;
}
}
return true;
}
</script>
Ext Control foreground Display information: directly call the corresponding control's ID
Copy Code code as follows:
<table>
<tr>
<td> name:</td>
<td><ext:textbox id= "Txtname"/>
<td><ext:button onclientclick= "return Yandncheck ();" />
</tr>
</table>