// Calculate the time difference between the two dates by several hours. diffdayhourstring = function (date1, date2) {var date3; If (typeof date1 = "object") {date3 = date2.gettime ()-date1.gettime (); // time difference in milliseconds} else {date3
During the last few days of system creation, I suddenly found that the time selected from the Time Selection box always reported an incorrect format. I found through debug that an error was reported when I used parseint, the strange thing is that
1. ff and IE determine whether the DOM object has been loaded
The DOM object in IE has the readystate attribute, which can be determined by readystate = "complete.The DOM object in FF does not have the readystate attribute and can only use onload
Escape () method:The specified string is encoded using the ISO Latin character set. All space characters, punctuation marks, special characters, and other non-ASCII characters will be converted into character encoding in % XX format (XX equals to
FlashProgramCurrently, the function of saving and loading external files is available. We can call flash in JavaScript to enable Javascript to read and write data offline to the local hard disk.
Some Japanese have written some code to implement
This is one of the most powerful keywords in JavaScript. Unfortunately, if you don't know how it works, it will be hard for you to use it correctly.
Http://www.javaeye.com/topic/24457
Summary of this usage in Javascript
This is an
How to achieve automatic Page scrolling display?When you double-click a webpage, the webpage will automatically scroll down. When you click it again, the scroll will stop. Set the followingCodeInsert to :
The loading and execution processes of JavaScript are vague. Now we can look at the loading and execution processes of JavaScript from a few simple examples.
Example 1:
Results and Analysis: the script is loaded in sequence. After each script is
Monomer (Singleton) Pattern is one of the most basic and most commonly used patterns in Javascript. It is often used to divide namespaces and modularizeCodeAnd reduce global variables.
The following is the basic structure.
VaR Singleton = {
On a page, the most common page element is input. But how can we use JavaScript to obtain the value input in the webpage input? It is actually very simple and there are more than one method, according to my summary, the following two methods are
1. Greedy pattern: match as many strings and expressions as possible. It is called greedy pattern.For example,/a \ D +/can match many numbers after the first letter is.Or another method/A \ D {2,}/can implement the same method.2. Non-Greedy mode:
Recommended jquery template plug-in jtemplates
Jtemplates is a javascript template engine based on jquery plug-ins. Official Website: http://jtemplates.tpython.com/
Data preparation:
VaR DATA = {totalcount: 64, lists: [{ID: '000000', Title: 'news 11
Document directory
Add-2011-8-5
Data Exchange
Javascript data types are not rich in C ++. The best way is to pass data through strings, package and parse the data according to the Conventions. If JavaScript transmits data to ActiveX without
It solves the problem of direct copying in Firefox, but the Execution Code contains the tag that references the JS file. In Firefox, the script cannot be downloaded and cannot be correctly executed. You can learn from them!
RUN copy and
Window
The window object is a browser or framework itself. Top is always a browser, parent is a parent framework, and Self represents itself.Windows can be omitted.
Window operation: moveBy (dx, Dy), moveTo (x, y ),ResizeBy (DW, DH), resizeTo (W,
1. Document. Write (""); Output statement
2. Comments in JS are //
3. The traditional HTML document sequence is: Document-> HTML-> (Head, body)
4. the DOM sequence in a browser window is: window-> (navigator, screen, history, location, document)
5.
After reading an interactive source code, I think it is also very skillful to add Js. I would like to share my thoughts with you:
__CreateWlnPath = function (js) { if (true) { var scripts = document.getElementsByTagName("script");
/* each object instance has a prototype property member used to point to its instanceof object (temporarily referred to as the parent object) we call this layer-by-layer relationship to the parent prototype [prototype Chian] prototype also has
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