As we all know, a javascript
Code Ending with a semicolon and ending with a carriage return can run properly in the browser (at least in my IE7 ). I don't know if this is a feature of the JS language, or is it just the fault tolerance feature of
There are many methods, for example:
First: (use the charcodeat method of the string object)
CopyCode The Code is as follows: String. Prototype. getbyteslength = function (){
VaR length = 0;
For (I = 0; I Icode = This. charcodeat (I );
If (icode> =
Document.doc umentelement. getboundingclientrect
Here is the description of msdn:
Syntax
Orect = object. getboundingclientrect () Return Value
Returns a textrectangle object. Each rectangle has four integer properties (top, left, right, and bottom)
nesting of quotation marks
The ASCII code of single quotation marks is 39 double quotation marks. The ASCII code is 34, so we can use xx; to replace the specific symbol. Although it is changed to the form of XX;, you should be very careful in
Effect:
Let's take a look at how other websites do it:
Google.com Logon: both the client and server have been verified, and the message is the same.
Logon to Baidu.com: the password input box is blocked.
Http://fanfou.com/register: the client
There are onmouseleave and onmouseenter in IE, which is a headache for Web developers who want to be compatible with various browsers.
Although there are some suggestions for Mozilla Firefox on the internet
CodeThe amount is not optimistic.
I
Function styleheadersiblings (){
If (! Document. getelementbytagname) return false;
VaR headers = Document. getelementbytagname ("h1 ");
For (VAR I = 0; I Addclass (ELEM, "Intro ");
}
}
Function styleelementsiblings (TAG, thechass ){
If (!
// Function name: strbytelength
// Function Description: returns the length of a string in bytes.
// Parameter description: string to be checked by Str
// Return value: String Length
Function strbytelength (STR)
{
VaR I, sum;
Sum = 0;
For (I = 0; I {
Enjoy it first and try it in two steps.
I am an invincible game player (amateur jscoder )~, Pinch Haha... author: fengyunwu welcome to the bbs.51js.com carefree script, a bunch of cool! ^-^
[Ctrl + A select all Note: If you
*** comment fresh fruit reply
pizicai comment You reply
Function fillinmessagearea (othis ){
VaR text = othis. parentnode. childnodes [0]. firstchild. nodevalue;
TEXT = 'reply '+ text;
Text + = ':';
VaR me_area = $ ('#
In fact, this book has been in my computer, but I have never read it carefully. I have never officially learned JavaScript, and I will find some help on the Internet when I use it occasionally.
Code Let's change it and use it. This time, I started
CopyCode The Code is as follows :/*
* Copyright (c) 2007-2009 skylark
* Email: aohailin@gmail.com
* Version: 2.1
* Original
Program , Reprinted, Please retain the Copyright
*/
VaR $ = function (o) {return typeof o = "string "? Document.
CopyCode The Code is as follows: function $ cookie (){
VaR A = arguments. callee;
VaR B = A. _ cached;
If (A. _ cached) {return a. _ cached}
If (! (This instanceof A) {return new}
If (typeof A. _ cached = "undefined") {A. _ cached = this}
}
$ Cookie.
Force pop-up window
Code Research-forcewindow
This is an old code. This Code builds a form and uses js to submit the form (you can also simulate the submit button to be clicked ). I tested it in IE8 but it was blocked in Firefox 3.5.
Copy code The
Today, I have excerpted some methods related to date operations in js on the Internet. I 'd like to share with you.
Copy codeThe Code is as follows:
The specific extension method is as follows:ParseCHS -- static method. Parse common Chinese dates
Javascript Object comparisonComparison OPERATOR: = ,! =, = ,! ==, >=, , = Always try to compare them straight, if the types are different, always try to convert.=== Comparison same, comparison without conversion= If it is a basic type (string,
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