Void is an operator in JavaScript, and the syntax is as follows:
Javascript:void (expression)
Javascript:void expression
void evaluates the value of an expression, but discards the return value of an expression.
This expression is often used to make
As a result, they always keep the latest and most accurate information. Essentially, all NodeList objects are queries that run in real time when accessing DOM documents. For example, the following code can cause an infinite loop:
Copy Code
Copy Code code as follows:
var a=["Apple", "Peach", "Banala"];
This is another way of defining an array, which is equivalent to
Copy Code code as follows:
var a=new Array ();
A.push ("Apple");
A.push ("Peach");
Now the page has many kinds of page effects, commonly used with pop-up layer effect, seamless scrolling effect, tab switching effect. Today to share a native JavaScript to write the tab switch effect, because I have a limited level, if you have
Using Microsoft's JSON serialization library so date would be
Copy Code code as follows:
/date (1224043200000)/
An effective approach is to
Mydate.replace (/\/date\) ((. *?) \) \//gi, "New Date ($)");If you want to convert a format,
what happens when a cross-domain occurs?
Suppose the domain name is: http://www.example.com.cn/
If the requested domain name is not the same as this domain name, this is a cross-domain, and due to cross-domain vulnerabilities, normal Cross-domain
Yesterday to participate in a front-end interview, which has an array to weight, the first thought is the object key value method, the code is as follows
method One: (Simple deposit key value)
Copy Code code as follows:
Sample code:
Copy Code code as follows:
var xxxVar1 = 1;
var outer = function () {
var xxxVar2 = 2;
var results = [];
for (var i = 0; i{
var inner = function () {
var xxxVar3 = 3;
return XXXVAR3 + xxxVar2
code example:
Copy Code code as follows:
var date1 = new Date (2013,1,1);
var date2 = new Date (2013,1,1);
Date1 = = Date2; The execution result is false
Date1 = = Date2; The execution result is false
var num1 = new number
Copy Code code as follows:
var intervalbody = function () {
Console.log (' interval ');
}
var startinterval = function () {
SetInterval (intervalbody,1000);
}
var timeoutbody = function () {
Console.log (' timeout ');
I. Basic CONCEPTS
encodeURI and decodeURI are used in pairs, because the browser's address bar has Chinese characters, you can have unexpected errors, so you can encodeuri to translate non-English characters into English code, decodeURI can be used
In JS, creating objects (create object) is not exactly what we often say to create class objects, JS objects are emphasized is a composite type, JS to create objects and access to objects is extremely flexible.
JS object is a composite type, which
When dealing with a problem, it is recorded,
Copy Code code as follows:
function Onopenwin () {
if (window.name!= "Oaopenwindow") {
Win = window.open ("Login.aspx", "Oaopenwindow", "Toolbar=no, Menubar=no, Scrollbars=no,
1
,
Window.onerror
Events
The OnError event is used to assist in processing JavaScript errors on the page. When an exception occurs on the page, the error event is triggered on the Window object. For example:
In this case, the
1. The processing of the adaptive height of iframe under the same domain name
Copy Code code as follows:
Of course here I'm using asp.net MVC where SRC is set to the routing structure
Copy Code code as follows:
Original: Enforcing toString ()
Forced ToString () in JavaScript
Translator: Singleseeker
JavaScript usually automatically turns values into the desired type based on the needs of the method or operator, which can cause various errors. Brian McKenna
The following function receives a parameter that can be an array or an element that returns the text of an element.
Copy Code code as follows:
function text (e) {
var str = "";
If the element is passed in, get its child elements
When an array needs to be emptied, many people use the following method:
Copy Code code as follows:
a = [];
We know that JavaScript variables are stored in the form of reference types and direct quantities. The array belongs to
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