Display ads by judging the specified directory
Copy Code code as follows:
if (Location.href.indexOf ("http://www.jb51.net/codes/") >-1) {
Alert (' OK ');
}
Copy Code code as follows:
var Cts = "Bbltext";
Copy Code code as follows:
String.prototype use
Batch substitution, for example: Str. ReplaceAll ([/a/g,/b/g,/c/g],["AAA", "BBB", "CCC"])
String.prototype.replaceall=function (a,b) {
var c=this;
for (Var i=0;iC=c.replace (A[i],b[i]);
};
JavaScript defaults to prototype inheritance. Although there is no concept of Class (class), its functions (function) can act as constructors (constructor). Constructors combine this,new to build a Java-like class. As a result, JavaScript can
background:Write a simple chat system that emits a HTPP URL to implement the jump plus a tag.
Implementation code:
Copy Code code as follows:
String.prototype.httpHtml = function () {
var reg =/(http:\/\/|https:\/\/) (\w|=|\?| \.| \
Suppose the current time is now 7000 milliseconds. When the time is 3000--6000 is to go 3000 value, when 6000--9000, take 6000 of the value, that is, the maximum value of the XML is less than the current time
XML file,
Copy Code code as
A while ago, it swept the JavaScript and felt good about myself. Now I think, I feel nothing. The task today is to asp.net the chapter on the lifecycle of client pages in Ajax. However, because the content of this chapter makes me have some
Convert a picture into a character drawing through JavaScript
1. Get Upload Image Object dataJavaScript does not directly capture data from locally uploaded images, HTML5 can solve the problem. HTML5 inside the FileReader interface can read the
One: JavaScript static page value pass URLCan pass the value of the URL. Connect the information you want to pass to the URL.Post.htm
Copy Code code as follows:
Read.htm
Copy Code code as follows:
Yesterday, when writing a very simple HTML page with some basic JavaScript scripts, it took 1 hours to find out where the error was. Simply give the following similar code to see if you can find the problem there?
Look carefully and then find out.
Copy Code code as follows:
function Banbackspace (e) {
var ev = e | | window.event;//Get Event Object
var obj = Ev.target | | ev.srcelement;//Get Event Source
var t = Obj.type | | Obj.getattribute (' type ');//Get Event Source Type
Get the
The principle is to loop through the controls on the Web page, and then set the Disabled property to true.
The code is as follows:
Copy Code code as follows:
The following are the types of these controls:
can be obtained by
Copy Code code as follows:
Verifying the format of a file
function Validatefile () {
var fileobject=$ ("#filename");
var errorobject=$ ("#error");
var filepath=fileobject.val ();
var filearr=filepath.split ("//");
var
The original use of JS to read and write cookies has not paid attention to a problem:The same key value, different domain (locahost.dev.xxx.com, dev.xxx.com, xxx.com, etc.) can exist in the cookie at the same time, Document.cookie can read these
Let's take a screenshot first.
The mouse moves to the corresponding classification, the following red small triangle will automatically follow, slow to follow.No matter how many are available.JavaScript code:
Copy Code code as follows:
One of the biggest differences between JS and Java is that functions are also considered data and can operate like an object in Java. And because JS does not perform type checking, the array can store anything. So I wondered if the array could hold
Each function has a prototype attribute, called a prototype. Each object also has a prototype, which can be accessed through __proto__ in the Firefox/safari/chrome/opera, and no related interfaces are provided in IE6/7/8.
Copy Code code as
Today encountered a need to use JavaScript to replace some of the parameters in the URL of the requirements, remember that not long ago from the internet to find a parseurl function, just can use this implementation, code collation as follows:
The match function in JavaScript uses a regular expression to find the string and returns the result of the lookup as an array, which is useful in practical development, using the following methods:Stringobj.match (RGEXP)Where stringobj is a
Copy Code code as follows:
/**
* Returns a random lowercase letter
*/
function Getlowercharacter () {
Return Getcharacter ("lower");;
}
/**
* Returns a random capital letter
*/
function Getuppercharacter () {
Return Getcharacter
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