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.
<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
<script language= "javascript"
function Yandncheck () {
if (document.getElementById) (" The ID of the current corresponding textbox in the 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 for ASP control
<table>
<tr>
<td> name: </td>
<td> <asp:textbox id= "Txtname"/>
<td><asp:button onclientclick= "return Yandncheck ();" />
</tr>
</table>
Second: Ext control's judgment information
<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: Call the ID of the corresponding control directly
<table>
<tr>
<td> name: </td>
<td><ext:textbox id= "txtname"/>
<td><ext: Button onclientclick= "return Yandncheck ();" />
</tr>
</table>