function Isnotempty () {
var inputs=document.getelementsbytagname ("INPUT");//Get control
if (inputs!=null) {
if (inputs[0].type== "text" &&inputs[0].value== "" "| | inputs[1].type== "text" &&inputs[1].value== "" | | inputs[2].type== "text" &&inputs[2].value== "")
{
Parent.$.messager.show ({
Title: ' Hints ',
Msg: ' number, name cannot be null '
});
Inputs[0].focus ();
}else {
Fun ();//Adjust
}
}
}
Use Var inputs=document.getelementsbytagname ("INPUT"); Gets an array of controls. Determines whether a control is empty
function Fun () {
var desc1=$ (' #desc1 '). Val ()
$ (' #dd '). Dialog ({
Title: ' Hints ',
WIDTH:300,
height:150,
Closed:false,
Modal:true,
Cache:false,
Content: "<span class= ' info ' > sure you want to add" ["+desc1+"] "This button name?" </span> ",
buttons:[
{
Text: "To confirm",
Handler:function () {
$.post ("<%=request.getcontextpath ()%>/keydesc/savekeydesc", $ (' #myform '). Serialize (), function (TX) {
if (tx== "success") {
/* Parent.$.messager.alert (' hint ', ' add success '); */
Alert (' Hint ', ' add success ');
Parent.$.messager.show ({
Title: ' Hints ',
Msg: ' Add success '
});
parent.$ (' #dialog '). Dialog (' Close ');
parent.$ (' #dg '). DataGrid (' reload ');
}
});
$ (' #dd '). Dialog ("Close");
}
},
{
"Text": "Cancel",
Handler:function () {
$ (' #dd '). Dialog ("Close");
}
}]
});
}
////////////////////
<div id= "DD" ></div>
Validation method to determine whether input is empty