Profile
Achievement
![first submission:submitting first snipplet first submission:submitting first snipplet](/img/badge/badge_2.png?v3)
![popular snippet:having a snipplet with 20 favorites popular snippet:having a snipplet with 20 favorites](/img/badge/badge_3.png?v3)
1man's Recent SnippetsTagged javascript
- All /
« Prev 1 Next »
An example taken from JavaScript: The good parts showing how to catch an exception.
0
815
posted 13 years ago by 1man
Adds a class of hasJS to the html element, can be used for CSS styling.
1
930
posted 15 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
1306
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
769
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
617
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
725
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
788
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
672
posted 16 years ago by 1man
addEvent function. Can't remember the exact site i got it from. Works well for me.
1
597
posted 17 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
578
posted 17 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
952
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
989
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
1039
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
698
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
899
posted 17 years ago by 1man