8
I like to have these two methods in my toolbelt, even though it's syntactic sugar, I think it aids clarity.
9
Rather than have standalone functions rtrim, ltrim, and trim (as in http://www.bytemycode.com/snippets/snippet/397/) why not have them as methods of all string objects?
7
A websafe colour palette generator in JavaScript. Coded this after looking at http://www.bytemycode.com/snippets/snippet/585/ and wanting to do it differently.
It's been refactored so that:
* can pass generateColourPalette an arbitrary array of colour codes and it'll generate a palette.
* it hooks into the page through the external file
* uses an internal stylesheet instead of inline styles
It's been refactored so that:
* can pass generateColourPalette an arbitrary array of colour codes and it'll generate a palette.
* it hooks into the page through the external file
* uses an internal stylesheet instead of inline styles
12
Basically, you can dynamically ask the webpage to look at a current object's attributes/values or even change the object's attributes/values. As such, running this script on any browser of your choice should show what attributes your particular browser will allow for an object reference you typed in.
23
This is a PHP and JavaScript Image gallery that I created. There are 2 uses for this.
1.) You can save it as index.php and place in a folder containing images and it will display the images in that folder.
Example:
place index.php in images/folder
http://yoursite.com/images/folder/
This will display all images in that folder
2.) Pass in the path to the folder to display in the url
Example:
Save as imagegallery.php
http://yoursite.com/imagegallery.php?path=images/folde
1.) You can save it as index.php and place in a folder containing images and it will display the images in that folder.
Example:
place index.php in images/folder
http://yoursite.com/images/folder/
This will display all images in that folder
2.) Pass in the path to the folder to display in the url
Example:
Save as imagegallery.php
http://yoursite.com/imagegallery.php?path=images/folde
8
This is a swear filter script I wrote for my xanga blog. I don't know if it has any application anywhere else. This will replace the swear words listed in the array with the character defined in blank_char. This isn't perfect but it works pretty well.
6
This snippet also you to limit the input in a form field to a specified number of characters. It displays a counter so users can see how many characters they have left, and once they reach the limit the field just trims the length to your limit.
The following is a snippet from what I used when I implemented a tagboard to my site. Further revisions could/should read the LIMIT from the maxlength attribute
The following is a snippet from what I used when I implemented a tagboard to my site. Further revisions could/should read the LIMIT from the maxlength attribute
11
This script will allow for conditional loading of javascript libraries. The example here only has one condition to check for IE or Firefox then loads the appropriate .js file.
This is part of an .aspx template for an educational portal product.
Usage for loading the script:
This is part of an .aspx template for an educational portal product.
Usage for loading the script:
11
I found this to be a neat little trick for hiding(somewhat) source javacscript code from peering eyes...
This function will unload all linked javascript files so that when you view source - you see no javascript files! (Especially helpful when using FF and using web-developer tools - no linked js files are displayed) The files remain resident in memory - allowing for the functions to work.
Just call the function in the tag
This function will unload all linked javascript files so that when you view source - you see no javascript files! (Especially helpful when using FF and using web-developer tools - no linked js files are displayed) The files remain resident in memory - allowing for the functions to work.
Just call the function in the tag
8
This code is used in an Educational Portal product but can be tweaked to fit your need.
This code adds a small icon next to the title of a 'portlet' that resides on the page. By clicking the portlet title, the portlet usually maximizes within the constraint of the portal template - but the extra icon allows for the portlet to be opened in it's own window.
This simulates an MDI interface.
(REQUIRES PopItUp snippet)
This code adds a small icon next to the title of a 'portlet' that resides on the page. By clicking the portlet title, the portlet usually maximizes within the constraint of the portal template - but the extra icon allows for the portlet to be opened in it's own window.
This simulates an MDI interface.
(REQUIRES PopItUp snippet)








