Javascript controls margin-top, margin-left, margin-right...
Never do this.
Document. getelementbyid ("div1"). style. Margin-Top = "30px"; // This is incorrect.
Document. getelementbyid ("div1"). style. margintop = "30px"; // This is incorrect.
Visible area width of the webpage: Document. Body. clientwidthVisible area height: Document. Body. clientheightVisible area width of the webpage: Document. Body. offsetwidth (including the width of the edge)Visible area height of the webpage:
Background
It is often necessary for new recruits to explain the two concepts of javascript: single line and scope chain. Today I will write another blog to explain it. Single thread
Queue: Only one queue is used to store callback methods.
Note: What is inappropriate in the Translation? Thank you for your correction and wish you a happy double festival!
Link: http://www.jspatterns.com/shim-sniffing/
It is not good to extend native objects and prototype without special needs.
Simple DescriptionJSPrototype
PrototypeProvides a mechanism for sharing attributes and methods of similar objects.,The object inherits all attributes and methods of the prototype (Functions). To put it bluntlyJSClass inheritance is implemented
Learning how to use JavaScript to create Web ApplicationsProgramPreviously, we spent three minutes learning about the development of Web applications, which is roughly divided into four stages:
1. text-based hyperlinks
In this phase, web
Document. Form. ItemProblem
Existing problems:
ExistingCodeThere are manyDocument. formname. Item ("itemname ")Such statements cannot be run in Firefox.
Solution:
SwitchDocument. formname. elements ["elementname"].
Collection Object
Practical JS
Code Fragment-there are a lot of special webpage effects code. Here we collect some common and practical js code snippets.
Font size scaling
It makes the text bigger and clearer to more users. (You can also change the font to a
The original is here: http://dmitry.baranovskiy.com/post/91403200
Quick test for real understanding of JavaScript core beyond closures and scopes. here five small scripts. try to answer what will be alerted in each case without running them in
1. Solve 2000 problems
Function Y2K (number) {return (number 2. Check whether the date is valid
// When the input parameter is isdate (DD, mm, ccyy), it indicates the year, month, and day to be checked.
// When the input parameter is isdate (DD, mm),
〓 New users purchase SLR Ultimate strategy 〓 talk about essentials and key points of on-site machine inspection-polishing your eyes and fighting against JavaScript code ◆ cherish the budget, Please carefully perform machine inspection !! ◆
◆
JavaScript code formatting Tool
JS downloaded onlineCodeCode is often compressed (comments, line breaks, indentation, spaces, tabs, and so on are all deleted). If you are studying and studying the code, you will be dizzy. Some editor's "lattice
0. undefined Introduction
Undefined
Is a property of
Global Object
, I. e. It is a variable in global scope.
Javascript 1.8.5
Note
Starting in Javascript 1.8.5 (Firefox 4 ),UndefinedIs non-writable, as per the ecmascript 5
You can find a lot on the Internet about how to define classes in JavaScript.Article. Before starting, let's take a look at the two types of definition classes.Basic MethodRight:
(1) construct types using functions.
Function Foo (text, URL)
Currently, Microsoft Internet Explorer and Firefox are commonly used browsers. We can no longer distinguish ie from Netscape. Neither of them has a document. Layers object, nor does Firefox have a document. All object. However, Firefox can correctly
Does Ruby's method_missing magic have similar equivalents in JavaScript? The answer is the _ nosuchmethod _ method of spidermonkey. The demo is as follows (Please launch firebug ):
VaR OBJ = {}; obj. _ nosuchmethod _ = function (/* string
The operation flow is generated when the execution of a function depends on the results of multiple asynchronous operations. This is actually a type of event distribution. Use ie only as follows:
Document. attachevent ("onclick", function ()
Test the click event first. The following is the test code:
var addEvent = document.addEventListener ? function(el,type,fn){ el.addEventListener(type,fn,false);}:function(el,type,fn){ el.attachEvent("on"+type,function(){
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