Welcome To Snipplr
Everyone's Recent JavaScript Snippets Tagged javascript
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
each in Array,It can operate each element in Array.
e.g.
var result = [1,2,3,4].each(function(x){return Math.sqrt(x);});
//it return sqrt in [1,2,3,4]'s each item
0
514
posted 14 years ago by hand4ever
The AJAX Libraries API is a content distribution network and loading architecture for the most popular, open source JavaScript libraries.
1
806
posted 14 years ago by jonkemp
The Location object is part of a Window object and is accessed through the window.location property. It contains the complete URL of a given Window object, or, if none is specified, of the current Window object.
0
677
posted 14 years ago by jonkemp
Although $(document).ready is incredibly useful, it occurs during page render while objects are still downloading. You can reduce CPU utilization during the page load by binding your jQuery functions to the $(window).load event, which occurs after al...
2
700
posted 14 years ago by jonkemp
Use chaining in jQuery to reduce the code size and gain better performance.
0
687
posted 14 years ago by jonkemp
via [http://mir.aculo.us/2010/06/04/making-an-ipad-html5-app-making-it-really-fast/](http://mir.aculo.us/2010/06/04/making-an-ipad-html5-app-making-it-really-fast/)
for CSS3 Transitions, Transforms, Animation also see:
[http://css3.bradshawenterp...
0
712
posted 14 years ago by cfleschhut
This requires jQuery. The script checks to see if default text is present in a text field on focus. If it is, then it clears the text. Otherwise, it leaves user entered text intact. This is normally used for a search box.
0
831
posted 14 years ago by jonkemp
Extremely simple random image when using similar naming structure and a set number of images (eg. imagePrefix_1,jpg, imagePrefix_2,jpg, etc.)
0
652
posted 14 years ago by d55beck
This is a script [tweeted by @gregmuellegger](http://twitter.com/gregmuellegger/status/16618146398). Example usage: Supports f("Hello %s.", ["World"]) and f("Hello %(name)s.", {name: "World"})
0
869
posted 14 years ago by glends
If you need to sort an array in javascript this is how it should be done. Casting toLowerCase() is optional but but necessary if fx "Anne" was spelled "anne"
0
831
posted 14 years ago by fengelz
based on [http://net.tutsplus.com/tutorials/javascript-ajax/create-a-simple-powerful-product-highlighter-with-mootools/](http://net.tutsplus.com/tutorials/javascript-ajax/create-a-simple-powerful-product-highlighter-with-mootools/)
0
623
posted 14 years ago by cfleschhut
This is the correct markup for an inline script tag for HTML 4.01 and XHTML 1.0
Note the lack of any "language" attribute since this is deprecated.
In HTML 4, the content type is declared as CDATA, which means that entities will not be parsed....
0
942
posted 14 years ago by PapillonUK
Will convert all of the mysql dates on the page to be localized.
0
775
posted 14 years ago by yisreldov