Developing cross-browser JavaScript
1. ChildNodes the difference between FF and IE.
Node (NodeType = 1) in FF is separated by Textnode (NodeType = 3), and ie/op is not.
content
Under FF, the childnodes of Box1 is 3, IE is 1.
2. Set the style
Change them all to uppercase or lowercase, and compare them.
IndexOf the character position of the substring for the first time within the object
With toLowerCase or toUpperCase
[Ctrl + A All SELECT Note: If the need to
If you only need to manipulate the DOM, then there is no need to wait for the page to load. We need a quicker approach.
Firefox has domcontentloaded events can be easily resolved, unfortunately, ie did not.
One of MSDN's methods for JScript is
js function for calculating character length
Copy Code code as follows:
function LEN (str) {
var i,sum=0;
for (i=0;iif ((Str.charcodeat (i) >=0) && (Str.charcodeat (i) sum=sum+1;
Else
sum=sum+2;
}
return sum;
}
Consider the following code
if (Node.nextSibling.className = = ...) {
...
}
If node or node.nextsibling is null (NULL), an error is returned. So, typically, the code for the solution is
if (node) && (next = node.nextsibling) && ...) {
...
}
The previous chapter basically to explain the basic knowledge to say some, today finally began to write code: D First to do an example, bulk upload UI controls. Examples that are typically done in the future are also dominated by UI controls. are
The first is too simple to say, the second is also very simple, but everyone has a different implementation method, the following gives a relatively concise approach to support IE6, IE7, FF2, other browsers are not tested (can be extended to the asp.
Consider the following code
if (Node.nextSibling.className = = ...) {
...
}
If node or node.nextsibling is null (NULL), an error is returned. So, typically, the code for the solution is
if (node) && (next = node.nextsibling) && ...) {
...
}
Then,
This is a Q&a page where the designer wants to be able to click on the relevant question and show the corresponding answer below it. This is a more common feature, and the usual solution is to treat the answer as a child of the entire problem
In fact, the principle is very simple. Also first, the Type property is GetAttribute, and the button is captured. Then, when the button is onclick, I pass through the URL to the child page.
Copy Code code as follows:
input1
1. About prototype: Here prototype is a feature of JavaScript, not the famous prototype framework:
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
2. About variable scope, and
To access the specified node:
Getelementsbyname ():
dom Technology Choose the color you like!" red green blue
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Focus Element
What elements can get the focus? By default, only the form element can get the focus. Because only form elements can interact
There is also a way to get focus on non-form elements by tabIndex setting the property to-1
A few days ago suddenly want to do a lens effect, suddenly thought of this effect, so find the Year "collection" code decided to taste the wish.
Objective:
This program is mainly divided into three parts: the layer of drag and drop, layer scaling,
To add a CSS class to the specified element:
Changing the appearance and feel of elements by adding CSS classes is a very clean method, not adding inline styles. Using JQuery, it's easy to do:
$ (' #myelement '). addclass (' MyClass ');
To remove
Some of the knowledge points of javascript:
1. The five most popular browsers: Chrome,firefox,safari,ie,opera2. Simplified version of how browsers work:3.Js by Ecmajavascript;dom; BOM composition;4.js is a weakly typed language (that is, it needs
Objective
Front-end routing is supported in many open source JS library frameworks, such as Angularjs,backbone,reactjs and so on. The same way that front-end routing and back-end routing is to allow all the interaction and presentation to run on
[CSS3] uses JAVASCript to trigger the transition effect. css3javascriptUsing Pseudo classes such as hover and: focus, we can easily switch elements from one style to another, and switching will have a transitional effect. But sometimes we want 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.