Welcome To Snipplr


Everyone's Recent JavaScript Snippets



1 ... 55 56 57 58 59 ... 65
1 1803 posted 18 years ago by gbot
Quick example to show how 'this' depends on how the function in which you called it in was being invoked. From jQuery in Action.
1 1732 posted 18 years ago by 1man
An example of how to extent the jQuery objects to include our own methods.
0 2075 posted 18 years ago by 1man
Usage: onmouseout='if (isMouseLeaveOrEnter(event, this)) YourActionHere();' onmouseover='if (isMouseLeaveOrEnter(event, this)) YourOtherActionHere();'
1 2081 posted 18 years ago by Winkyboy
Para realizar validaciones en Javascript rápidamente. Requiere que en la etiqueta metamos un onSubmit="return checkform(this);" . Este trozo de código es para dos campos input con nombres campo1 y campo2.
0 1224 posted 18 years ago by betacontinua
If you have a complex function you may need to pass it lots of arguments. Instead of having to remember how many you need to pass, and passing 'null' for un needed arguments, pass the function an object. Now you can set the defaults inside the fun...
0 1894 posted 18 years ago by 1man
I got this code from http://blog.vishalon.net/Post/57.aspx The actual two methods required are function doGetCaretPosition (ctrl) { var CaretPos = 0; // IE Support if (document.selection) { ctrl.focus (); var Sel = document.select...
3 5904 posted 18 years ago by arunpjohny
/* ---===[ EXAMPLE ]===--- */ var TT = new AssociativeArray(); TT.add("k-1", "Value 1"); TT.add("k-2", "Value 2"); TT.add("k-3", "Value 3"); TT.add("k-4", "Value 4"); alert(TT.to_string());
1 1478 posted 18 years ago by vbert
/* --==[ EXAMPLE ]==-- var colors = new AArray(); colors.add("k01", {bk:"#fff",tk:"b",it:"hello"}); var oC = colors.get("k01"); var tT = ''; for(K in oC) tT += "[" + K + "]: " + oC[K] + "\n"; tT += "\n\n"; tT += oC.bk + "\n"; tT += oC...
1 2111 posted 18 years ago by vbert
Wasn't fully tested :) Just for reference...
3 1922 posted 18 years ago by oxisound
(c) copyright Stephen Chapman, 1st Jan 2005. Example: alert('http://'+uri.dom+uri.path+'/folder/file.js');
0 1664 posted 18 years ago by oxisound
This makes it easy to retrieve certain value from a url with different values appended to it.
0 2012 posted 18 years ago by iTony
prevent errors in other browsers
0 1980 posted 18 years ago by localhorst
This would make IE treat the hover element in whichever tag you implemented.
0 1255 posted 18 years ago by iTony
curvyCorners is a free JavaScript program that will create on-the-fly rounded corners for any HTML DIV element, that look as good as any graphically created corners.
3 2295 posted 18 years ago by jonhenshaw
Will toggle an element's style.visibility, or set it to visible/hidden as selected
0 1753 posted 18 years ago by martinkas
0 1707 posted 18 years ago by iTony
2 2041 posted 18 years ago by xalexx
0 1517 posted 18 years ago by ecavazos
4 1951 posted 18 years ago by AgentPhoenix
Then, your code should look like this ... $(document).ready(function() { $("dt > a").click(function(){ $(this).parent().nextUntil('dt').toggle(); return false; }); });
0 1592 posted 18 years ago by thecrumb
#modal would be the bodyID of your modal window. I use jqmodal so it strips out all the header tags, and takes your body ID and turns it into a div.
2 1812 posted 18 years ago by kristin
Found this quick little bit of code on the Google jQuery discussion group. It simply fades the background image of a link you have hovered over to a certain color, then fades it back to the original color.
4 1908 posted 18 years ago by 1man
This is to prevent a form from being inadvertently submitted.
0 1823 posted 18 years ago by ecavazos
1 ... 55 56 57 58 59 ... 65