JavaScript effects:
A constantly floating picture, any side of the browser, will change the direction of the float, like a pinball. This effect is mainly used for Web site advertising, code as follows, the following code saved as HTM file can be
Example
The code is as follows
Copy Code
This will pop-up ads in the specified time range, and of course, as with Cookies server script can be set, the following way to see a cookie
The code implements a
Array Length:
The JavaScript array does not need to be set in length, it expands itself, and the array name. Length returns the number of elements
The code is as follows
Copy Code
var arr=new Array ("Saab", "Volvo",
Changing HTML Properties
To change the attributes of an HTML element, use this syntax:
The code is as follows
Copy Code
document.getElementById (ID). attribute=new value
This example changes the SRC attribute
First to the most basic, look at the following code
The code is as follows
Copy Code
var str = ' SASLDFJLKDSJF ';Console.log (Str.replace (/sa/, ")");
SLDFJLKDSJF so you can replace the SA in the STR string,
This idea:
1. Bypassing the mark to get the actual number of words, such as the need to display the contents of the first 100 words, bypassing the tag to retrieve the 100th word of the actual index. The string before this index is then intercepted.
get the specified element of the HTML file get the specified element of the HTML file Get HTML file element body get the Elements of HTML files H2 get the Elements of HTML files p
JavaScript Tutorial Gets the contents of the specified element of
Defines a regular expression, because the JS pair can only replace oneConvert to "2000/01/01"var regs = new RegExp ("-", "GI");var Date1=document.getelementbyid ("Begindate");var Date2=document.getelementbyid ("EndDate");Date1=date1.replace (regs, "/
Metacharacters^ $ . * + ? = ! : | / ( ) [ ] { }When using these symbols, you need to use "" for the transfer.If you don't remember that those punctuation marks need to be transferred, you can use the backslash "" when using punctuation marks.Simple
To create a webpage that complies with web standards, you often need to define the first child or last element under a parent element to distinguish it from other elements, this helps to meet certain special requirements. The simplest example is the
Tip: you can modify some code before running On 1First?Second?Third? On 2First?Second?Third? On 3First?Second?Third? Tip: you can modify some code before running
Tip: you can modify some code before running Yu Ge's work-two-level multi-choice menu>" />>" />The city you selected Tip: you can modify some code before running
1. I will not talk about the program. We can directly find a piece of code or use it in our own application. The following is a piece of test code as shown in the figure:2. Open the browser and enter the file address. The following interface is
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