Profile

Achievement

first submission:submitting first snipplet popular snippet:having a snipplet with 20 favorites

1man's Recent SnippetsTagged javascript



« Prev 1 Next »
An example taken from JavaScript: The good parts showing how to catch an exception.
0 148 posted 10 years ago by 1man
Adds a class of hasJS to the html element, can be used for CSS styling.
1 179 posted 11 years ago by 1man
Click on an input field with a prefilled value, if that value equals the default then select it, if not leave it as it was. Relies on jQuery.
2 272 posted 11 years ago by 1man
Using JSON-P with jQuery. Note the callback.
0 176 posted 11 years ago by 1man
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 180 posted 12 years ago by 1man
Apologies if I haven't explained this to well, I'm still trying to get my head round closures.
0 120 posted 12 years ago by 1man
Simple way of allowing functions to take optional arguments. Always place the optional arguments last, so you don't have to explicitly pass an argument as "undefined".
3 149 posted 12 years ago by 1man
Basic usage of the in and instanceOf operators.
0 157 posted 13 years ago by 1man
Very simple drag and resize function.
1 171 posted 13 years ago by 1man
Very basic way to toggle an element to slide in and out using mootools 1.1. Uses FX.Slide, other transitions are available.
2 175 posted 13 years ago by 1man
Create a simple object and add properties and a method. Note where the object is parsed (not from top to bottom).
2 129 posted 13 years ago by 1man
addEvent function. Can't remember the exact site i got it from. Works well for me.
1 125 posted 13 years ago by 1man
Shows you how to link 2 objects together via the object function. If a value isn't found in the object, it will look for it in the linked object.
0 125 posted 13 years ago by 1man
This function allows you to parse a simple XML document(passed to it using this.href on a onclick event). Virtually the same as JSON, the things that have been changed ate labeled !Important.
3 193 posted 13 years ago by 1man
This function is near enough the same as parsing XML. The only things that have changed are the sections marked !important.
3 208 posted 13 years ago by 1man
This function allows you to open a new window, without using any inline Javascript. Simply add rel="external" to the link you wish to open in a new window.
3 213 posted 13 years ago by 1man
This is another script from the DOM scripting book. Not really relevant to anybody else. Useful for reminding myself about the DOM.
1 138 posted 13 years ago by 1man
Stop the background image flickering on IE by including this code in the header of your page. See link for more information.
2 194 posted 14 years ago by 1man
« Prev 1 Next »