Welcome To Snipplr


Everyone's Recent JavaScript Snippets



1 ... 55 56 57 58 59 ... 65
1 1120 posted 17 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 1111 posted 17 years ago by 1man
An example of how to extent the jQuery objects to include our own methods.
0 1469 posted 17 years ago by 1man
Usage: onmouseout='if (isMouseLeaveOrEnter(event, this)) YourActionHere();' onmouseover='if (isMouseLeaveOrEnter(event, this)) YourOtherActionHere();'
1 1499 posted 17 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 809 posted 17 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 1334 posted 17 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 5075 posted 17 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 966 posted 17 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 1457 posted 17 years ago by vbert
Wasn't fully tested :) Just for reference...
3 1378 posted 17 years ago by oxisound
(c) copyright Stephen Chapman, 1st Jan 2005. Example: alert('http://'+uri.dom+uri.path+'/folder/file.js');
0 1157 posted 17 years ago by oxisound
This makes it easy to retrieve certain value from a url with different values appended to it.
0 1406 posted 17 years ago by iTony
prevent errors in other browsers
0 1375 posted 17 years ago by localhorst
This would make IE treat the hover element in whichever tag you implemented.
0 829 posted 17 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 1637 posted 17 years ago by jonhenshaw
Will toggle an element's style.visibility, or set it to visible/hidden as selected
0 1132 posted 17 years ago by martinkas
0 1204 posted 17 years ago by iTony
2 1470 posted 17 years ago by xalexx
0 1023 posted 17 years ago by ecavazos
4 1303 posted 17 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 1115 posted 17 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 1204 posted 17 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 1332 posted 17 years ago by 1man
This is to prevent a form from being inadvertently submitted.
0 1228 posted 17 years ago by ecavazos
1 ... 55 56 57 58 59 ... 65