1. Define the width and height of the pop-up box with the percentage of screen available and high
var truewidth = $ (Top.window). Width () * 0.9;
var trueheight = $ (Top.window). Height () * 0.9;
2. Verify the number when the cursor is away
Js
function Checkisnan (t) {
var isnanvalue=$ (t). Val ();
var strp=/^\d+$/;
if (!strp.test (Isnanvalue)) {
Alert ("Please enter a number!") ");
$ (T). focus ();
return false;
}
}
Html
<td><input name= "number" onblur= "Checkisnan (This)"/></td>
3. Default value for text box when losing focus
Js
function cls (t) {
If the current value is the default value, clear the
if ($ (t). val () = = "Enter the first letter or name to retrieve") $ (t). Val ("");
}
function res (t) {
Resets to default values if the current value is empty
if ($ (t). val () = = "") $ (t). val ("Enter the first letter or name search");
}
Html
<input id= "UserName" value= "Enter initial or first name to retrieve" onfocus= "CLS (this)" onblur= "res (this)"/>
4. Convert the time entered into a number into a year-month-day form
function Changetime (t) {
var time = $ (t). Val ();
var strp =/^\d+$/;
if (!strp.test (time)) {
Alert ("Please enter a eight-digit time number!") ");
twice + = 1;
if (twice < 3) {
$ (T). focus ();//When more than two operations are wrong, the cursor is not returned
}
else {
twice = 1
}
return false;
}
if (time.length = = 8) {
var year = time.substring (0, 4);
var month = time.substring (4, 6);
var day = time.substring (6, 8);
$ (T). Val (year + "-" + month + "-" + day);
} else {
Alert ("Please enter a eight-digit time number!") ");
}
}
5. Select all rows in the table
function Checkall (t) {
var Isbool = t.checked;//t is generally written this
var a = $ (t). Parent (). Parent (). Children (). Children (). Children (). Children ("TD"). Children ("input"). each (function () {
JS's Dynamic Add property
this.checked = Isbool;
});
6. Reverse Selection in table
function Invertselection (t) {
var isbool = t.checked;
if (Isbool) {
Select the Deselect button to remove the check box
$ (t). Parent () parent (). Parent (). Children ("Legend"). Children ("Input[name= ' Listcheckbox ']"). each (function () {
JS's Dynamic Add property
this.checked = false;
});
$ (t). Parent () parent (). Parent (). Children (). Parent (). Children (). Children (). Children ("TD"). Children (" Input "). each (function () {
JS's Dynamic Add property
if (this.checked = = True) {
this.checked = false;
}
else {
This.checked = true;
}
});
}
else {
//
$ (t). Parent () parent (). Parent (). Children (). Parent (). Children (). Children (). Children ("TD"). Children (" Input "). each (function () {
JS's Dynamic Add property
if (this.checked = = True) {
this.checked = false;
}
else {
This.checked = true;
}
});
}
var B = $ (t). Parent (). Parent (). Parent (). Children ("Legend").
}
7. Jump to the specified page when the check box is checked-----------------
function Checkmore (t) {
var isbool = t.checked;
if (Isbool) {
Location.href = ". /admin/afterstorage.aspx ";
}
else {
Location.href = ". /admin/auditedsupply.aspx ";
}
}
8. Code when the foreground passes the value
$.post ("/admin/suppliesorder/actions/fuzzycheckconsumable.ashx?keyword=" + Escape (request.term)//escape is used to decode
The background receives the pass value to decode again
string keyword = System.Web.HttpContext.Current.Server.UrlDecode (keyword);
9. Clear the query criteria
function Clearquery () {
$ (' #tbsearch '). Find ("Input"). Val ("");
}