Profile
Achievement
1man's Recent SnippetsTagged javascript
- All /
« Prev 1 Next »
An example taken from JavaScript: The good parts showing how to catch an exception.
0
712
posted 13 years ago by 1man
Adds a class of hasJS to the html element, can be used for CSS styling.
1
820
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
1181
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
717
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
568
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
673
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
736
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
627
posted 16 years ago by 1man
addEvent function. Can't remember the exact site i got it from. Works well for me.
1
562
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
533
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
896
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
932
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
979
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
651
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
841
posted 17 years ago by 1man