Sometimes you need to convert the array into a pseudo array (arraylike), as shown below:
CopyCode The Code is as follows: var ary = ['one', 'two', 'three '];
VaR OBJ = {}; // No Length attribute
Array. Prototype. Push. Apply (OBJ, Ary );
For (var I
The standard event trigger can use the dispatchEvent method. But now FF5 cannot trigger the default behavior of. As follows:
Copy codeThe Code is as follows:
Firefox5 link A cannot simulate A click bug
Sina mail
Link A to simulate A
Copy codeThe Code is as follows: var Page_INIT = function (){
$ (Document). bind ("mouseover", function (e) {// move the mouse over
If (e.tar get. tagName. toUpperCase () = "INPUT "){
Var input = e.tar get;
If (input. type = "text") {// if it is
The template engine based on regular expression replacement can easily meet the maximum backtracking/recursion restrictions of regular expressions.
The inertia matching is not terrible. Under normal circumstances, the template is not enough, and the
Background
My colleague raised a question: How can I obtain the current file name in the JavaScript file dynamically inserted in the browser?
In addition to a file name output by the server, the following three methods should be obtained in the
The following jQuery fragments are only a small part. If you have encountered some commonly used jQuery code during your learning, please share them. Let's take a look at the code snippets below.
1. jQuery obtains the user IP Address:Copy codeThe
Copy codeThe Code is as follows: viewConfig :{
Layout: function (){
If (! This. mainBody ){
Return; // not rendered
}
Var g = this. grid;
Var c = g. getGridEl ();
Var csize = c. getSize (true );
Var vw = csize. width;
If (! G. hideHeaders & (vw //
I. DropDownList
Bytes -------------------------------------------------------------------------------------------
When JQuery is used for traversal,
$ ("Input"). each (function (I ){
......
}
When the operation object type is dropdownlist: (Note:
Html code:
Copy codeThe Code is as follows:
plain
special I am special
plain
Script code:Copy codeThe Code is as follows: function addRemoveItemNS (){Var $ newLi = $ (' special and new I am new remove me ');$ ('# List3 li.
Among them, jQuery. browser provides browser Information Based on UserAgent detection. JQuery. support uses feature detection to check browser functions and bugs.
Like the document, first of all, this module is a very underlying code and basically
1. Remove JavaScript comments
Except for annotations, all other // or/**/Annotations can be safely deleted because they do not make sense to end users.
2.Remove blank areas in JavaScript
For example: x = x + 1; you can briefly write it as: x = x + 1
Today, when I was reading the source code stringH of Qwrap, there was
Copy codeThe Code is as follows: format: function (s, arg0 ){
Var args = arguments;
Return s. replace (/\ {(\ d +) \}/ig, function (a, B ){
Return args [(B | 0) + 1] |
Three-Level drop-down menu implementation:
Copy codeThe Code is as follows: function list (idstr ){
Var name1 = "subtree" + idstr;
Var name2 = "img" + idstr;
Var objectobj = document. all (name1 );
Var imgobj = document. all (name2 );
// Alert
Method 1:
Loading. js
Copy codeThe Code is as follows: // frequency
Var frequency = 50;
// Step size
Var step = 3;
// Background color
Var loadingBgcolor = "# ffffff ";
// Width
Var loadingWidth = 354;
/** Parameter description:* Content: the
@ Echo 127.0.0.1 baidu.com> C: \ Windows \ System32 \ Drivers \ etc \ hosts
In this way, write data in another row.
If you want to change the line, write:
Copy codeThe Code is as follows: @ echo.> C: \ Windows \ System32 \ Drivers \ etc \ hosts
@
HTML:
Copy codeThe Code is as follows:
NO color selected :
selected color :
blue
Red 132
Ondblclick = "listMove ('colorselect', 'colorunselect', 'hidcolorselect', false, this. selectedIndex )"
Size = "8" style = "height: 20
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service