1, so that the right key and replication failure
Method 1:
It is easy to prevent the right mouse button from selecting the text code simply by adding the following two lines of code to the head tag's JavaScript.
Add the following code to the Web
JavaScript Learning first season (1)
1, javascript Character set:
JavaScript uses the Unicode character set encoding.
Why do you use this code?
The reason is simple, 16-bit Unicode encoding can represent any
Instance
I summarized the following, wrote a JS method, the main solution: a date + how many months days = a date of the problem. As for, a date-a date = how many days
The code is as follows
Copy Code
Solve the
Today, looking at someone else's code, you find that the function you called is not what you think it is. So take a serious look at the code, and then combine the previous JS about call notes. Know the reason for this
The code is as
Code:
The code is as follows
Copy Code
var Strdatearraystart = Begindate.split ("-");var strdatearrayend = Enddate.split ("-");var strdates = new Date (strdatearraystart[0] + "/" + strdatearraystart[1] + "/" +
The code is as follows
Copy Code
HTML code
This example takes only one paragraph and sets the default class attribute "Testnormal" to it, and the mouse across and out will trigger the two JavaScript functions above,
Because before touching it, most people think this is the patent for the OOP language. At least that's what I used to think.
With the passage of time, the further improvement of JavaScript. This veil of mystery has been lifted step after step.
The replace () method replaces some characters in a string with some other characters, or replaces a substring that matches a regular expression.
GrammarStringobject.replace (regexp/substr,replacement) parameter descriptionRegexp/substr required.
Here's how to use it:1. Default: In plain text "↑ TOP" showvar mytop = new Xttop ();2. Call Picture:var mytop =new xttop ({img: Picture path});Like I'm going to call a picture of the outreachvar mytop =new xttop ({img: "Http://www.111cn.net"});Of
The character limit for the contents of the same cookie is different for different cookie versions. In Cookie Version 0, some special characters, such as spaces, brackets, parentheses, equal numbers (=), commas, double quotes, slashes, question
Simple explanation of the Web page special effects commonly used regular expressions, this is mainly about the number of JS, telephone, mobile phone, user name, such as commonly used regular expression implementation, there is a need for friends can
The following method is very simple, is to use the value of TA,TB to get the ID of the specified div is dispay=block or none to show or hide div oh, to achieve the switching effect.
JavaScript Documentfunction Show1 (TA,TB,TT){for (i=1;i{if (tt==
To make character or string substitutions in JS we can use the Replace () method to replace some characters with some character in a string, or to replace a substring that matches a regular expression.
Stringobject.replace
How to write a Switch statement.JavaScript Switch StatementIf you want to choose to execute one of several blocks of code, you can use the switch statement:Grammar:Switch (n){Case 1:Execute code block 1BreakCase 2:Execute code block 2BreakDefaultIf
The valueof () method returns the original value of a String object.
The original value is inherited by all objects that are down from the String object.
The valueof () method is usually invoked automatically in the background by JavaScript,
Web effects Regular expression verification email address Enter the email address, click Test, the wrong address will return false ... Right, show it? Guess for yourself:
character processing;Go to the left and right space;function Trim (s) {return RTrim (LTrim (s));}Go to the left space;function LTrim (s) {Return S.replace (/^s*/, "");}Go to the right space;function RTrim (s) {Return S.replace (/s*$/,
1. Let the text keep rolling
scrolling Text
2. Record and display the last modified time of a Web page
3. Close the current window
close window
4. Close the current page after 5 seconds
5
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