Partial Refresh:
This method is much more common;
$. Get method, $. Post method, $. getjson method, $. Ajax method is as follows
The first two methods are basically the same.
$. Get ("Default. php", {ID: "1", page: "2 ″},
Function (data ){
// Here is the callback method. Return data. How can this problem be solved.
});
$. Getscript method:
$. Getscript ("http://jqueryajax.com/jquery.js ",
Function (){
$ ("# Go"). Click (function () {// callback Method
$ (". Block"). animate ({backgroundcolor: 'pink'}, 1000)
. Animate ({backgroundcolor: 'blue'}, 1000 );
});
});
$. Getjson only returns different data types
$. Getjson ("Default. php", {ID: "1", page: "2 ″},
Function (data ){
// Note that the JSON Data Reference Method returned here is "data.info". If you do not understand it, check the JSON tutorial. I won't explain much here.
});
$. Ajax is probably used by many people. But I don't like this very much. I personally think the first two are more convenient.
$. Ajax ({
Type: "post", // type of submission
URL: "Some. php", // submit address
Data: "name = John & location = Boston", // Parameter
Success: function (MSG) {// callback Method
Alert ("data saved:" + MSG); // the content of the method is the same as the get method above.
}
});
The following describes how to refresh the entire page:
Window. Location. Reload () refresh the current page.
Parent. Location. Reload () refresh the parent object (for frame)
Opener. Location. Reload () refresh the parent window object (used for single-open window)
Top. Location. Reload () refresh the top object (used to open multiple Windows)
Next we will introduce some basic JavaScript Functions.
-
- 1.doc ument. Write (""); is the output statement
-
- 2. Comments in JS are //
-
- 3. The traditional HTML document sequence is: Document-> HTML-> (Head, body)
-
- 4. the DOM sequence in a browser window is: window-> (navigator, screen, history, location, document)
- 5. Get the name and value of the element in the form: Document. getelementbyid ("ID of the element in the form"). Name (or value)
-
- 6. javascript: Document. getelementbyid ("output"). value = Document. getelementbyid ("input"). value. touppercase ();
-
- 7. value types in JS: String, number, Boolean, null, object, Function
-
- 8. Convert the numeric type in JS to the numeric type: parseint (), parsefloat ()
-
- 9. convert numbers in JS to numeric: ("" + variable)
-
- The string length in 10. JS is: (length)
-
- 11. The character and character in JS are connected with the + number.
-
- 12. The comparison operators in JS include: = equals ,! = Not equal to,>, >=, <. <=
-
- 13. Declare variables in. js using: var for declaration
-
- 14. js judgment statement structure: If (condition) {} else {}
-
- 15. Loop Structure in JS: For ([initial expression]; [condition]; [upadte expression]) {inside loop}
-
- 16. The command for loop abort is break.
-
- 17. Function Definition in JS: function functionname ([parameter],…) {Statement [s]}
- 18. When multiple form forms appear in the file, you can use document. Forms [0], document. Forms [1] instead.
-
- 19. Window: open window. open (), close a window: window. Close (), the window itself: Self
-
- 20. Set the status bar: window. Status = "character ";
-
- 21. The pop-up message is window. Alert ("character ");
-
- 22. Pop-up confirmation box: window. Confirm ();
-
- 23. Window. Prompt ();
-
- 24. Specify the position of the currently displayed link: window. Location. href = "url"
-
- 25. Retrieve the number of all forms in the form: Document. Forms. Length
-
- 26. Close the output stream of the document: Document. Close ();
-
- 27. String append connector: + =
-
- 28. Create a document element: Document. createelement (), document. createtextnode ()
-
- 29. method for getting the element: Document. getelementbyid ()
-
- 49. Reference a file-Type JS: <SCRIPT type = "text/JavaScript" src = "AAA. js"> </SCRIPT>
-
- 50. Specify the HTML displayed in a browser that does not support scripts: <NoScript> </NoScript>
- 51.when both hyperchains and onclickjs are available, the browser turns to a.html and the browser turns to B .html. For example: <a href?a.html "onclick=location.href=' B .html '; return false"> dfsadf </a>
-
- 52. js built-in objects include: array, Boolean, date, error, evalerror, function, math, number, object, rangeerror, referenceerror, Regexp, String, syntaxerror, typeerror, urierror
-
- Line feed in 53. JS: \ n
-
- 54. full Screen Window Size: <SCRIPT> function fullscreen () {This. moveTo (0, 0); this. outerwidth = screen. availwidth; this. outerheight = screen. availheight;} window. maximize = fullscreen; </SCRIPT>
-
- All in 55. js represents all the elements in its lower layer.
-
-
- 56. js focus sequence: Document. getelementbyid ("form element"). tabindex = 1
-
- 57. the value of innerhtml is the value of the form element, for example, <p id = "para"> "How are <em> You </em>" <p> </P>, the value of innerhtml is: how are <em> You </em>
-
- 58. The value of innertext is the same as the above, but the <em> mark is not displayed.
- 59. contenteditable: You can set whether the element can be modified. iscontenteditable returns whether the element can be modified.
-
- 60. isdisabled determines whether it is in the forbidden state. Disabled sets the forbidden state.
-
- 61. length gets the length and returns an integer value.
-
- 62. addbehavior () is an external function file called by JS. Its extension is. HTC.
-
- 63. Window. Focus () before all windows.
-
- 64. Blur () indicates losing focus. Opposite to focus.
-
- 65. Select () indicates that the element is selected.
-
- 66. Prevent users from entering text in the text box: onfocus = "This. Blur ()"
-
- 67. Retrieve the number of elements that appear on the page: Document. All. Tags ("Div (or other HTML tags)"). Length
-
- 68. JS is divided into two forms of output: modal and non-modal. Window. showmodaldialog (), window. showmodeless ()
-
- 69. Set the text in the status bar: window. Status = 'text'. The default text in the status bar is window. defaultstatus = 'text .';
-
- 70. Add to favorites: External. AddFavorite (http://www.google.com, Google ");
-
- 71. js does not perform any operation when it encounters a script error: window. onerror = donothing; syntax for specifying the error handle: window. onerror = handleerror;
- 72. js specifies the parent window of the window currently opened: window. opener, supporting opener. Opener... .
-
- 73. Self in. js refers to the current window.
-
- 74. js status bar display content: window. Status = "content"
-
- 75. Top in JS refers to the top-level framework in the framework set.
-
- 76. Close the current window in JS: window. Close ();
-
- If (confirm ("Are you sure ?")) {Alert ("OK");} else {alert ("not OK ");}
-
- Window redirection in 78. JS: window. navigate ("http://www.google.com ");
-
- 79. js print: window. Print ()
-
- Window. Prompt ("message", "defaultreply ");
-
- Window scroll bar in 81. JS: window. Scroll (x, y)
-
- 82. JS: window. scrollby
-
- Set the interval in 83. JS: setinterval ("expr", msecdelay), setinterval (funcref, msecdelay), or setTimeout
-
- The Mode in 84. JS is displayed in ie4 + lines, but not in NN: showmodaldialog ("URL" [, arguments] [, features]);
- 85. handle used before exit in JS: function verifyclose () {event. returnvalue = "we really like you and hope you will stay longer. ";}} window. onbeforeunload = verifyclose;
-
- 86. file handle used when the form is called for the first time: onload ()
-
- 87. file handle called when the form is closed: onUnload ()
-
- 88. window. location attributes: Protocol (HTTP :), hostname (www.example.com), Port (80), host (www.example.com: 80), pathname ("/A/a.html "), hash ("# giantgizmo" refers to jump to the corresponding anchor), href (all information)
-
- 89. Window. Location. Reload () refresh the current page.
-
- 89-1.parent.location.reload () refresh the parent object (for frame)
-
- 89-2.opener.location.reload () refresh the parent window object (used for single-open window)
-
- 89-3.top.location.reload () refresh the top object (used to open multiple Windows)
-
- 90. window. history. back () returns the previous page, window. history. forward () returns the next page, window. history. go (return the page number, or use the accessed URL)
-
- 91.doc ument. Write () output without line feed, document. writeln () line feed output
- 92.doc ument. Body. nowrap = true; prevents link text from being broken.
-
- 93. variable name. charat (nth digit), which is the nth character of the variable.
-
- 94. "ABC". charcodeat (NTH), returns the ASCII value of the nth character.
-
- 95. String connection: String. Concat (string2), or use ++ = to connect
-
- 96. Variable. indexof ("character", starting position), returns the first occurrence location (starts from 0)
-
- 97. String. lastindexof (searchstring [, startindex.
-
- 98. String. Match (regexpression) to determine whether the character matches.
-
- 99. String. Replace (regexpression, replacestring) to replace the existing string.
-
- 100. String. Split (separator) returns an array storage value.
-
- 101. String. substr (start [, length]) takes the string from the nth digit to the specified length.
-
- 102. String. tolowercase () converts all strings to lowercase.
-
- 103. String. touppercase () converts all characters to uppercase.
-
- 104. parseint (string [, Radix (representing hexadecimal)]) is forcibly converted to an integer.
-
- 105. parsefloat (string [, Radix]) is forcibly converted to floating point type.
-
- 106. isnan (variable): test whether it is Numeric.
-
- 107. Key words defining constants: const; key words defining variables: VaR
from: http://ysongren.blog.163.com/blog/static/61542207201002153937/