1. The standard method
Copy Code code as follows:
Example: (' http://www.jb51.net ', ' 500px ', ' 400px ', ' no ') ' > click
2. It is to be noted that Firefox does not support this feature, it supports the syntax is
window.
Set Cookies
Each cookie is a name/value pair, and you can assign a string such as the following to Document.cookie:
Document.cookie= "userid=828";
If you want to store more than one name/value pair at a time, you can use a semicolon plus a space (
We are generally in accordance with the order of random touch of the cards from small to large order in the hands of neat (remember as a child card two players can not grasp it), this essay is to realize this function to familiarize with the next JS
ReplaceChild (A,B) is used to replace an existing element in a document.
Parameter A: the node to insert,
Parameter B: the node to replace
Copy Code code as follows:
var odiv = document.getElementById ("Guodiv");
var Ospan =
Copy Code code as follows:
/*
Each object instance has an attribute member for a prototype (prototype) that points to its instanceof object (tentatively called the parent object)
We refer to the relationship of this layer to the parent
The typical form data that is validated by JavaScript is:
Has the user filled out the required items in the form?is the e-mail address that the user entered legal?Has the user entered a valid date?Does the user enter text in the Data field (numeric
Copy Code code as follows:
Paul Tero, July 2001.
http://www.tero.co.uk/des/
//
Optimised for performance with large blocks by Michael Hayworth, November 2001
Http://www.netdealing.com
//
This SOFTWARE is provided ' as is ' and
Any
Copy Code code as follows:
function Gethistogram (imagedata) {
var arr = [];
for (var i = 0; i Arr[i] = 0;
}
var data = Imagedata.data;
var pow4 = Math.pow (4, 2);
for (var i = 0, len = data.length i var red = (Data[i]/64) | 0;
var green
This policy makes a significant restriction on the content of the page that JavaScript code can access, that is, JavaScript can only access content that is under the same domain as the document containing it.JavaScript is a security policy that is
Examples are as follows:
Copy Code code as follows:
/**
* Delete array elements by value
*
* @param mixed value element values
* @returns Array
*/
Array.prototype.deleteValue = function (value) {
var i = 0;
for (i) {
if (this[i] =
Sooner or later you will need to use the abstract results of other developers-that is, you rely on someone else's code. I prefer modules that depend on freedom (no dependencies), but that's hard to achieve. Even the beautiful black box components
One, what is Console.log ()?In addition to some very old versions of browsers, most browsers now have their own debugging capabilities, and can be supplemented by installing plug-ins even without debugging. For example, the old version of Firefox
1. Design Source
Copy Code code as follows:
javascript Get Path
2. Design result
(1) When initializing
(2) Get the current URL
(3) Get the directory after the host address
(4)
Event triggers can be interpreted literally to trigger events, but some friends who are not used may be confused, and are events not usually triggered by the user's actual actions on the page? This is not entirely true because some events must be
JavaScript anonymous function, which means that a function does not have a name, let's list the test code
Copy Code code as follows:
/*
* Commonly common functions are like this
*/
function Debug (data) {
Console.log (data);
One, suitable for numerical sorting and subtitle sortingThere are a number of ways to sort JSON, which is one of the simplest.
Copy Code code as follows:
var sortby = function (filed, rev, primer) {
Rev = (rev)? -1:1;
return function (A,
1, native JavaScript implementation string length intercept
Copy Code code as follows:
function Cutstr (str, len) {
var temp;
var icount = 0;
var patrn =/[^\x00-\xff]/;
var Strre = "";
for (var i = 0; i if (Icount temp = Str.substr
The following code runs through under IE8 and has an error in IE9:
Copy Code code as follows:
Document.createelement (' ');
Error tip: Exception:SCRIPT5022:DOM Exception:invalid_character_err (5)
Thinking Analysis:First step:
I. Sequence of occurrences
The origin of this problem is very simple, assuming you have another element nested within one element
Copy Code code as follows:
-----------------------------------
| element1 |
| ----------------------
To understand it according to the location of this, the situation can be divided into 3 kinds:
1, in the function: this is usually an implied parameter.
2, outside the function (in the top-level scope): In the browser this refers to the global
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