If we use AJAX technology frequently on the client side, we have to create XMLHTTP objects multiple times. Of course, as you know, we can improve the way we create, such as using global variables to cache an instance (client-side singleton mode?!). )
Html
Copy Code code as follows:
Javascript
Copy Code code as follows:
function Submit1 (e) {
var Isie = (document.all)? true:false;//whether the IE kernel or Mozilla
var key;
if (Isie)
Key = Window.event.keycode;//ie Use
First look at the common function usage of javascript
Copy Code code as follows:
function sum (a,b) {
var C = 10;
function Add () {
C + +;
}
Add ();
Return a + B + C;
}
var d = sum (4,5);
Alert (d)//20
As
For example, a control is rendered as a anchor control, and the DropDownList control here is rendered as a normal select control, A Web server control DropDownList and a common select control (primarily for comparison) are defined in the following
Let's take a look at the flaws in the superficial copy, how many people do not know?
Copy Code code as follows:
var ooriginal = {
Memnum:1,//number
MEMSTR: "I am A string",//String
Memobj: {
Test1: "Old value"//We LL Test
},
All the functions you create are case-sensitive.
Single quotes (' Strings ') and double quotes ("strings") have no special distinction in JavaScript, and can be used to create strings. But as a general rule, most Web developers choose to use single
Please test under Firefox
Look at the following example:
JS Code
is equivalent to
([][(! []+[])[!+[]+!+[]+!+[]]+(!! []+[][(! []+[])[+[]]+([! []]+[][[]])[+!+[]+[+[]]]+(! []+[])[!+[]+!+[]]+(!! []+[])[+[]]+(!! []+[])[!+[]+!+[]+!+[]]+(!! []+[])[+!+[]]
The following is an article abroad.
Http://www.jb51.net/article/20553.htm
Copy Code code as follows:
var sel = new Object ();
var sel_num = 0;
function Getcookieval (offset) {
var endstr = document.cookie.indexOf (";", offset);
if
But sometimes, when an event is triggered, we first do some operations, and then jump, at this point, we need to use JavaScript to achieve this jump function.
The following are the specific practices:
One: Jump to a new page, and when opened in a
Such a check has met a lot before, but each time is resolved on the end, no record down, and then the next encounter will spend a lot of time to write. Things need to accumulate, now special record down, hope that this kind of work no longer repeat
Like the sort of JavaScript array
There are also the deletion and grouping of the data in the array.
So, later in the interest to come up.
Out of hand.
Write a SQL library that can be applied in JavaScript
Later thought, how can not use JavaScript
Just sorted out some of the JavaScript cookies on the operation of the article, found that this article is also good, recommended that everyone together for reference, select the need, the lack of place is mainly on the path of the setting, like
Cloud-dwelling community to streamline the use of version, generally many CMS have some such functions. Dedecms in the selection of related articles is also used in such a function. Here is the specific code.
Parent page Core Code:
Copy Code
"Program Source"
This effect is mainly reflected in the combination of CSS and JavaScript
CSS Code
Copy Code code as follows:
UL, Li {margin:0; padding:0; border:0;}
. shop-rating {
height:25px;
Overflow:hidden;
Zoom:1;
PADDING:2PX
function code
Copy Code code as follows:
function parseURL (URL) {
var a = document.createelement (' a ');
A.href = URL;
return {
Source:url,
Protocol:a.protocol.replace (': ', '),
Host:a.hostname,
Port:a.port,
Js. Encode is encoded in the JS code after the formation of "garbled", this garbled in addition to reading, can still be good execution.
Often in the Web page has JS encryption code decoding method, but because there are escape characters in the
1, the number of long, in C # Legal long integer number in JavaScript unexpectedly ...
Look at the following lines of simple code:
Copy Code code as follows:
var a = 2010060612120909191; Id1 generated by Time
var B = 201006061212090
Original EnglishCreateadder (x) is a function, that returns a function. In JavaScript, functions are first-class objects:they can is passed to other functions as arguments and returned from fun Ctions as. In this case, the function returned are
Like what:
Copy Code code as follows:
Code 1
function Pig () {}
var pig = new Pig ();
Alert (pig instanceof Pig); => true
function Flypig () {}
Flypig.prototype = new Pig ();
var flypig = new Flypig ();
Alert
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