Welcome To Snipplr
Everyone's Recent JavaScript Snippets Tagged javascript
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Simple [SoundManager2](http://www.schillmania.com/projects/soundmanager2/doc/download/#latest "Download SoundManager2") example (uses jQuery)
0
928
posted 15 years ago by chrisdpratt
This will get the document's body in a very agreeable manner - it returns the first div on the page if there is no body (hey it can happen).
Adapted from code by Scott Schiller
0
557
posted 15 years ago by remotezygote
Puts a red border around anything with an inline style. Prefix with "javascript:" and paste into the address bar to run on a page directly, or run with a load event.
1
763
posted 15 years ago by DaveChild
Use this function to test whether or not a Javascript object is empty.
2
1029
posted 15 years ago by jlizarraga
I saw a lot of bad javascritp foreach examples ... so here is the best solution. See the link (german) for another snippet to iterate over object properties via foreach.
0
448
posted 15 years ago by naden
Page_ClientValidate is a global function. When called this will return true/false if the validator group provided is valid or not.
0
795
posted 15 years ago by jink
Usage:
//any element
window.onload = function(){
focusFirstInput();
}
or
// form elements under 'content-body'
window.onload = function(){
focusFirstInput('content-body');
}
0
800
posted 15 years ago by neoprolog
The code below will loop through the properties in an object and alert a string. myObject is in JSON notation. The "for ( x in y)" construct does not work if the Prototype.js library is included on the page
0
1282
posted 15 years ago by elugardo
Make sure you change the variable v_ga_track near the end of the script.
0
726
posted 15 years ago by chrisjlee
Remedial Javascript As Proposed by Douglas Crockford (http://javascript.crockford.com/remedial.html)
0
687
posted 15 years ago by quickredfox
Create two new bookmarks - one for dev, one for live and add the following corresponding code to each.
1
885
posted 15 years ago by Meander365
This method is better suited for processing large arrays in the smallest amount of time without affecting the user experience.
0
702
posted 15 years ago by iTony
This assumes HTML that looks like this:
<pre><code>
<div id="containing_div">
<div id="div_1" style="background-color:red" class="visible_div">
<p>Test Content 1</p&...
2
646
posted 15 years ago by chippper
Learn how to emulate ASP.NET's AppendFormat method in Javascript. AppendFormat is essentially a simple form of concatenation in ASP.NET.
1
827
posted 15 years ago by neal_grosskopf