E has a little-known function called conditional compilation (conditional compilation). Since the IE4 began to support conditional compilation, this feature has gradually gained more attention and is used in its own JavaScript code, even in some
Here are some of the simplest telephone number verification, which only determines that the user entered the data can be passed this is very problematic
The code is as follows
Copy Code
function Number_validator
The JavaScript length character length function, we use the length function for a lot of time, because you have to have the front desk judge whether a user's username and password length is what I want to specify.
Advanced scripters often need
The first three paragraphs describe the scope of the code
========== example 1==========
var scope= ' global ';
function fn () {
alert (scope);
var scope= ' local ';
alert (scope);
}
fn (); Output results?
alert (scope);//output
JavaScript functions can be divided into five categories altogether:
· General functions
· Array functions
· Date function
· Mathematical functions
· String functions
1. General functions
The JavaScript general functions include the following
The most recent learning JavaScript function, the function is a first-class object of JavaScript, want to learn JavaScript, you must have a deep understanding of the function. I put the process of learning into an article, one is to deepen their
One, data type
5 Basic types of data:null/undefined/string/boolean/number
1 kinds of complex data types:Object
Second, data type detection
A brief summary of several ways of detecting data types in JS and its advantages and disadvantages
1,
Collection (SET)
Talking about the collection, I remember just entered high school, the first lesson of mathematics is set. So when you learn to assemble this data structure, you feel more cordial.The basic nature of a set is one: The elements in
The JavaScript language is becoming more and more popular, and is one of the most prominent languages on the Internet. You can use it across platforms and browsers, and it doesn't repel back-end languages. There are many different development
question: How do I pass parameters to the SWF file using JavaScript?
Find a complete tutorial on the Internet, very enlightening and practical, the following is the complete implementation of the steps:
Configure SWFObject:
Swfobject2 is the best
Using JavaScript in HTML
JavaScript can embed HTML in two ways:
When used as statements and functions, use the SCRIPT tag
When used as an event handler, the HTML tag
SCRIPT tag
Use script tags to embed scripts in HTML, in the form
And the core of JavaScript is ECMAScript. Like other languages, ECMAScript strings are immutable, meaning that their values cannot be changed.
Please consider the following code:
Copy Code code as follows:
var str = "Hello";
str = "
first, from the writing cookie.。
var the_date = new Date ("December 31, 2020");
var expiresdate = the_date.togmtstring ();
Document.cookie = "userdefinecss=" + Escape (title) + "; expires= "+ expiresdate;
The first sentence is the date object;
The
I have roughly translated some of the articles, may have misunderstood the place, please correct me. It is worth mentioning that the debate in the comments section is also worth seeing.
Feature Detection
At first, the front-end engineers objected
Previously discussed how to write in JavaScript. However, private implementations are not discussed. Look at this article.
We know that the implementation of JS private property is the essence of Var + closure. As follows
Copy Code code as
In daily development, the conversion between color gamut values in different formats is often used, and a workaround is given below.
Copy Code code as follows:
Regular expressions for hexadecimal color values
var reg =/^# ([0-9a-fa-f]{3
PS: This tank war is under the Internet a section of the source code, their own rewriting. itself is not too difficult things, this case will be JS object-oriented better, can be used as a JS object-oriented tutorial.
1. Create the basic object,
In IE 7 and earlier browsers, developers can only use flash plug-ins to implement this function because they do not have the ability to directly access the clipboard.Currently, some browsers support the clipboard function, except Safari on Mac and
JavaScript has been born for more than 20 years. The method we have been using to loop an array is as follows:For (var index = 0; index Console. log (myArray [index]);}Since JavaScript5, we can use the built-in forEach method:MyArray. forEach
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