$ ("Input[name= name]:checked of the current text box"). Val ()--Gets the value of the text box
$ ("Input[name= name]:input of the current text box"). Val ()--text box value
$ ("#文本框id"). Val ()---Get the text box value
Json.stringify (obj)-Converts a collection into character channeling
var myobject=[{name: ' Dahuang ', id:2},{name: ' Dahuang2 ', id:3},{name: ' Dahuang3 ', id:4}]----Declare a collection of objects
Json.stringify (object); Object Conversion String
Json.parse (string); String to Object
Object name [property name] = property value;//Add an attribute to the object
$ (obj). attr ("Property name", "property value"); Modify property value
----Clear the form contents
($ ("#选择器")) [0].reset ();
The ReplaceAll------------------------------------------------------in-----js
Str.replace (New RegExp (/(to be transferred)/g), ' want to transfer content ')
-----One of the most common Ajax-------------------------------------------------
$.ajax ({
URL: "./testxhr.aspx",//Request address
Type: "POST",//Request method
Data: {name: "Super", age:20},//Request parameter
DataType: "JSON",
Success:function (response) {
Code executed after this is successfully placed
Alert (1);
},
Error:function (status) {
Alert (2);
Code that executes after a failure is placed here
}
});
-----------------------------------------------
-------------------------------------------------
----Two interface, interface 1 get the value of interface 2 return to IDs (example: Cdcpro singlePage:jhbbldjglk.jsp and zzlist.jsp)
--Function code for Interface 1
function Myclick3 ()
{
var ids = window.showModalDialog (' mytest1.jsp ', null, ' dialogwidth=1000px;dialogheight=1000px ');
}
--Function code for Interface 2
function Test55 () {
Window.returnvalue = "ASDASDA";
Window.close ();
}
----------------------------------------------------------
-----------------------------------------------------------
---Gets the value of row I, Column J of table
$ (' #mytable tr '). Each (function (i) {
var td[i]=$ (this). Children (' TD '). EQ (0). html (); Get table
}
});
Add onchange Event-----------------------------page load
$ (document). Ready (function () {
$ ("#sTwo"). ComboBox ({
Onchange:function (n,o) {
Alert ("I'm the Boss!");
}
});
});
-----------------------
/*//Traverse TD Loop to get report card number
i=i+1;
var bgkbh= "";
$ (' #mytable tr '). each (function (t) {
if (i==t) {
bgkbh=$ (This). Children (' TD '). EQ (0). html (); Get table
}
});
*/
------------------------JS transcoding (Chinese----"garbled)
var gb2312unicodeconverter = {
Tounicode:function (str) {
return Escape (str). toLocaleLowerCase (). Replace (/%u/gi, ' \\u ');
}
, Togb2312:function (str) {
Return unescape (Str.replace (/\\u/gi, '%u '));
}
};
New method, call Gb2312unicodeconverter.tounicode (str) directly;
-------garbled back to Chinese. decodeURI (str);
-------------traverse all input from the test1 from
$ (' #test1 input '). each (function () {
alert (i);
i=i+1;
var name = THIS.name;
alert (name);
});
Front-end jquery some basic syntax