The code is as follows
Copy Code
Set Picture Auto Adjustfunction Setimgsize (pimg,iw,ih) {//pimg object, IW thumbnail width, ih thumbnail heightvar img = new Image ();IMG.SRC = PIMG.SRC;var w = IW;var h = ih;if (img.width>0 &&
Randomly remove n values from the array m to see the code:
The code is as follows
Copy Code
var m = [1,2,3,4,5,6,7,8,9, ' A ', ' B ', ' C ', ' d ', ' e ', ' # '];function Randarray (m, Len) {M.sort (function () {Return
Since we only need to mask a click event, we can use the settimeout () method to delay the processing of the Click event, and use the Cleartimeout () method to stop the event when you need to stop the click. In this way, you can easily write the
Use FCKeditor picture upload function, no matter how to set directory path, or set directory permissions, after the successful upload of pictures will often encounter a JS error "No Permissions", the successful upload of the file address can not
History objectsThe History object contains a Url,history object that is accessed by the user (in a browser window) as part of a Window object that can be accessed by the Window.history property, without the public standard applied to the History
The code is as follows
Copy Code
callback function 1function Callback (A,B,C){alert (A+B+C);}callback function 2function Callback2 (a,b){alert (A+B);}This method does some action, and then calls the callback functionfunction
First, the analysis of event location properties in different browsers:
1. IE Event.x,event.y is the reference point (excluding the scrolling distance) from the outside of the parent element of the event triggering element.2. Firefox's
Please see the following code:
The code is as follows
Copy Code
HTML code Click on the Back button to make the page to the homepage, you can click the browser Back button back to this page. The method used is
The code is as follows
Copy Code
/^ (d*.d{0,2}|d+). *$/
The test code given by Hansir is as follows:
The code is as follows
Copy Code
Untitled document
Matching links in source code
Can match the regular of links in HTML code.
The original post is:
/.+?/g feel a bit strict, first of all, to , and the href attribute can be one or more arbitrary characters other than the newline (not greedy).
Instance
The code is as follows
Copy Code
Results:
5
2
Chinese two, number three, correct
Instance
Check the length of Chinese and English respectively, Chinese is 2 bytes, English is 1 bytes
Data sorting sounds like only php tutorials, ASP tutorials, SQL to achieve, today we provide a data can be sorted at the client JS code, the need for friends can refer to.
function Sortcells (event) {
var obj = Event.target;
var count = 0;
Edit and modify the Web effects selectHere you can directly modify the value of the select content, you need friends can refer to.1 2 3 4 New Document 5 6 7 8 9 Style= "FONT-SIZE:12PX;" >test Press ENTER to enter new content and press Del to delete
In the picture after the success of the load can be added to the appropriate display (example in the wood is reflected, you can try to find a lot of source code on the Internet, but are false, is not to achieve what we want to save the browser
Gets the height width of the current screen (jquery/web effects)
Query gets the browser window wide and the width of the document is high
2010-01-20 08:59
Js
Page visible area wide: document.body.clientWidthPage visible Area
Now in the Firefox downward use will appear garbled problem (guest list use JS file), analysis reason Firefox, found in the CharSet settings do not work, Firefox will be based on the character set of the page to interpret JS files, Because the page
Slice usage
String.slice (NUM1, num2)String.slice (num)
The slice () method extracts a part of the string and returns the extracted part with a new string.
return valueA new string. Includes all characters for the string stringobject from start
String.Length This allows you to test the length of the string. Oh, this will help you get started with JS friends.
Gets the length instance of a string
A more detailed example.
Undefined variable is ' if no value has been assigned to it. The value that is not defined. The undefined string value is "undefined." Undefined Boolean values are false. Undefined variable is an original value. Undefined, is passed the
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