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 646 posted 13 years ago by 1man
Adds a class of hasJS to the html element, can be used for CSS styling.
1 762 posted 14 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 1116 posted 15 years ago by 1man
Using JSON-P with jQuery. Note the callback.
0 699 posted 15 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 679 posted 16 years ago by 1man
Apologies if I haven't explained this to well, I'm still trying to get my head round closures.
0 536 posted 16 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 629 posted 16 years ago by 1man
Basic usage of the in and instanceOf operators.
0 635 posted 16 years ago by 1man
Very simple drag and resize function.
1 737 posted 16 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 691 posted 16 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 589 posted 16 years ago by 1man
addEvent function. Can't remember the exact site i got it from. Works well for me.
1 534 posted 16 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 508 posted 16 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 844 posted 17 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 874 posted 17 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 927 posted 17 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 610 posted 17 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 795 posted 17 years ago by 1man
« Prev 1 Next »