In the past, the equal sign "=" has never been used in JS to use the equal symbol "= ". When the two operators only detect the equality of two objects, one executes the type conversion and the other does not convert. All equal to the symbol returns
VaR BQ = Document. getelementsbytagname ("tag or ID name") // ID is a unique and non-unique group. A tag may return an array.
DIV = Document. createelement ("Div ");
... Set the CSS style
Bq. appendchild (DIV); // If the ID is unique, you only need
Question: What is the sum that has been accumulated from 1 to 100?
Non-recursive statement:CopyCodeThe Code is as follows: 1run: function (){2 var sum = 0;3 For (VAR I = 1; I 4 sum = sum + I;5}6 console. Log (SUM );7}
Recursive Syntax:
Copy
Get HTML content in the editor
CopyCodeThe Code is as follows: function geteditorhtmlcontents (editorname)
{
VaR oeditor = fckeditorapi. getinstance (editorname );
Return (oeditor. getxhtml (true ));
}
Get text in the editor Copy codeThe Code
As follows:
CopyCode The Code is as follows: function student ()
{
// Define the field in the student class and grant the initial value. However, the access permission for this field is public.
This. studentno = 's001 ';
This. studentname =
Object creation declaration in javascript:
VaR OBJ = {}; or var OBJ = new object ();
Add attributes to an object. Method:
// ======= First writing method ======================================== ======
OBJ. Name = 'xiaoming '; // adds attributes to
1. HTML section:
CopyCode The Code is as follows: Align = "Left" bordercolorlight = "#000000" border = "1">
all regions
selected region
-- %>
-- %>
2. Javascript section:Copy codeThe Code is as follows:
3 ..
Question:
1.1 JavaScript flexibility
Object-oriented JavaScript programming mode: 1. Saving state 2. methods that can be called within an object 3.ProgramBetter understanding of its structure and able to withstand iterative development (I
VaR Ie =! + "\ V1 ";
Only 7 bytes! See this articleArticle, 32 bytes, ehr... 9, ehr... 7 !!! To know if your browser is IE, describes how foreigners reduce IE's judgment from 32 bytes to 7 bytes step by step! Story
But this record was broken
Simple event model and advanced event model
Simple event model and advanced event model simple events are the forms in which events are directly bound with page elements, such:CopyCodeThe Code is as follows: Element. onclick = function ()
You need to write a bit about this function.
Code . The following function can get a variable type. When you call a variable, a variable type described in the string format will be returned.
Copy code The Code is as follows: // obtain the type of
Today I will focus on how to extend array objects.
1. Extend it directly on array. Prototype
2. Use your own method to expand the array object
It can be expanded directly on array. prototype and cannot be used directly to DOM objects (for
The script is a simplified version. In general, many CMS have such functions. Selection in dedecms
Article This function is also used. The specific
Code .
Core code of the parent page:
Copy code The Code is as follows:
Core code of the sub-page:
First, let's take a look at how the animation of the past few days constructs javascript:
CopyCode The Code is as follows: var photo = function (){
VaR Index = 0, a, B, c, d;
Return {
Show: function (){},
Auto: function (){}
}
}
VaR AA = photo ();
/
All variables in JavaScript are of loose type. Different from other object-oriented speech, variable declarations are of strong type. Therefore, JavaScript variable declarations do not include types. Declare a variable by using the VaR keyword or
Test the browser version:
Ietester 6, 7IE 8.0Firefox 3.5.5Google Chrome 4.1.249.1064 (45376)Opera 9.64Safari 4.0
Let's take a look at the coordinate attributes of various mainstream browsers and their meanings.
In IE
Event. offsetxEvent.
// Function name: trim
// Function Description: removes spaces at the beginning and end of a string.
// Creation date:
// Last modify by: N/
// Last modify Date: N/
String. Prototype. Trim = function (){
Return this. Replace (/(^ \ s *) | (\ s *
(1) OnKeyPress event verification is used to verify input operations
Copy codeThe Code is as follows: function OnKeyPressValidate (obj, event, len ){
Var e = window. event | event;
Var key = e. keyCode? E. keyCode: e. which;
Var selectedText =
For example
Copy codeThe Code is as follows: var flower = function (){
Var t = 0, I = 0;
For (; I T ++;
}
Return t;
}
Flower returns t valueSuppose this function takes 2-3 seconds.Through the Memoization function, when the same value is
Almost all rich Web applications are based on one or more Web UI libraries or frameworks, which greatly simplify the development process and bring consistency and reliability, and highly interactive user interfaces. This article introduces 15 very
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