This article mainly introduces the usage example of call and apply in javascript, which is very detailed. if you need it, you can refer to call and apply usage and use call to inherit js classes.
/** Rectangle */function Rectangle (len, width) {this. len = len; this. width = width;}/** multiplied by */function multiply (a, B) {return a * B;} // var rectangle = new Rectangle (15, 30) of the rectangular ins
You can only enter a number and a decimal point using javascript. In some cases, it is still relatively used. The following is a good example. If you are interested, refer
The Code is as follows:
Function gaga (obj) {// a decimal point and number can be entered.Obj. value = obj. value. replace (/[^ \ d.]/g, ""); // replace all non-numeric values, except numbers and.Obj. value = obj. value. replace (/^
A small example of converting a date into a timestamp in javascript. For more information, see
The Code is as follows:
/*** Convert a date to a timestamp* Date Format: 21:12:13* Time_str: Date segment* Fix_time: 21:12:13*/Function strtotime (time_str, fix_time ){Var time = (new Date (). getTime ();
If (time_str) {// Date segmentVar str = time_str.split ('-');If (3 = str. length ){Var year = parseInt (
This article introduces a simple example of javascript to judge non-numbers. For more information, see
The Code is as follows:
Determines whether it is a number or space.
This article describes how to use javascript to create a simple example of a shortcut. If you need it, you can refer to setting the site as a trusted site.
The Code is as follows:
Var fso = new ActiveXObject ("Scripting. FileSystemObject ");Var shell = new ActiveXObject ("WScript. Shell ");Var tagFolder = "c: \ Temp ";If (! Fso. FolderExists (tagFolder )){Fso. CreateFolder (tagFolder );// Alert ("Creat
This article introduces javascript: The Example code that the text continuously moves to the left. If you need it, refer to it.
The Code is as follows:
This article introduces the JavaScript: Div layer drag effect example code. If you need code, you can refer to Div layer drag:
Implementation:CSS:
The Code is as follows:
JS:
The Code is as follows:
This article describes a simple example of the effect of a page translucent mask written in JavaScript, including a full-screen display of the div layer, if you want to know more about the effect of the translucent mask layer, you can use the plug-in to implement the effect of the translucent mask layer. Here we will share with you how to use native js to implement the translucent mask effect. If you are in
This article mainly introduces the basic framework of JS motion. examples show how to use javascript timers and div styles. if you need it, you can refer to the example below to describe the basic framework of JS motion. Share it with you for your reference. The specific analysis is as follows:
Note:
1. disable the existing timer when starting the movement2. separate motion and stop
The code is as follows
A small example of setting the IFrame height automatically in JavaScript. For more information, see
The Code is as follows:
Function SetIFrameHeight (down ){Var Sys = {};Var ua = navigator. userAgent. toLowerCase ();Var s;(S = ua. match (/msie ([\ d.] + )/))? Sys. ie = s [1]:(S = ua. match (/firefox \/([\ d.] + )/))? Sys. firefox = s [1]:(S = ua. match (/chrome \/([\ d.] + )/))? Sys. chrome = s [1]:(S =
Native javascript seamless scrolling currently supports vertical and horizontal scrolling. The following is a good example. You can refer to the currently supported vertical and horizontal scrolling.
Http://lgyweb.com/marScroll/
The following figure shows the basic idea for achieving seamless seams (vertical example ):
HTML structure:
The Code is as follows:
This article mainly introduces the setting of the default parameter value in Javascript, which is very simple but practical. If you need it, refer to the first one:
Function test (a, B) {var a = arguments [0]? Arguments [0]: 1; // set the default value of parameter a to 1var B = arguments [1]? Arguments [1]: 9; // set the default value of parameter B to 9 return a + B;
It is equivalent
Function test () {var a = arguments [0]? Arguments [0]: 1; //
In the example where JavaScript receives keyboard commands, press different keys on the keyboard, and the program will jump to different webpages. In this example, press the key program to jump to the homepage of the home of the script, and realize the function of clicking the button to jump. Press the key on the keyboard to go to the home page of the script hous
This code is a simple example. Extract two random images from the five images in the first div and display them to the second div. The specific implementation is as follows, if you are interested, you can randomly add images in the First dom to the second p by referring to javascript. This code is a simple example, extract two random images from the five images i
This article mainly introduces the XML Parsing method of JS. The example analyzes the XML file parsing skills of javascript for IE and non-IE browsers, which is of great practical value, for more information about how to parse XML in JS, see the example in this article. Share it with you for your reference. The specific implementation method is as follows:
This article mainly introduces the example of javascript Event Processing. if you need a friend, you can refer to the example code below:
The code is as follows:
JavaScript uses Baidu RSS for XML operations as a news source example. If you need it, you can refer to the js operation xml source for dynamic news on the page.
See the JS source code below (saved as an rss. js file ):
The Code is as follows:
Var main = document. getElementById ("content"). getElementsByTagName ("DIV ");/** The current directory contains a sub-folder named xml, and the referenced source
This article introduces a simple example of real-time display of the current time on the page. If you need it, you can refer to it.
The Code is as follows:
Real-time display of current time on pages using JavaScript
JavaScript uses Baidu RSS for XML operations as a news source example. If you need it, you can refer to the js operation xml source for dynamic news on the page.
See the JS source code below (saved as an rss. js file ):
The Code is as follows:
Var main = document. getElementById ("content"). getElementsByTagName ("DIV ");/** The current directory contains a sub-folder named xml, and the referenced source
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.