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 82 posted 9 years ago by 1man
Adds a class of hasJS to the html element, can be used for CSS styling.
1 104 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 140 posted 11 years ago by 1man
Using JSON-P with jQuery. Note the callback.
0 98 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 115 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 59 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 88 posted 12 years ago by 1man
Basic usage of the in and instanceOf operators.
0 93 posted 12 years ago by 1man
Very simple drag and resize function.
1 92 posted 12 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 112 posted 12 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 74 posted 12 years ago by 1man
addEvent function. Can't remember the exact site i got it from. Works well for me.
1 57 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 60 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 117 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 123 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 137 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 82 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 108 posted 13 years ago by 1man
« Prev 1 Next »