Save? Really?
11
This is an analog clock script designed to jump in place of a div element of class 'analogclock'.
The div tag is not replaced in this custom element, but instead is used as a pseudo-document to hold the clock itself. The 'hands' are implemented using arrays of generated divs.
I was actually inspired to write this widget because of an article on About.com's Javascript pages written by a guy named Stephen Chapman. His code was a mess, but I only discovered this after delving through two layers of 'unescape()' obfuscation.
The basics: You control the look of the numbers and the 'box' model of the clock using basic CSS. You control the clock's size (it will always be square) using the 'size' attribute.
The 'seconds', 'minutes', and 'hours' attributes are for the color of the 'hand's. 'numstyle' can be 1, i, I, or '.', each refering to a different type of face-numbering for the clock
The 'localzone' attribute tells the script to use the user's local time zone. If it's '0', 'false' or 'no', the clock will use the 'clockzone' attribute to determine what time it is (the clock zone is relative to GMT, so, for example, US Eastern is -5. The clock automagically figures out if we're in DST, so you don't have to.)
The 'city' and 'country' are for if you want to put in the city/country of origin for your clock. To be honest, you can put anything there.
Lastly, I designed my version of the clock to be able to not 'tick', i.e., work like the old-school analog clocks. If you want ticking, add 'tick=1' to the attribute list
As with all of my widgets, the idea here is that you can just include the .js file and start dropping in tags without needing to know any ECMAScript at all.
Additionally, for you ECMAScripters, I was very careful to keep my pollution of the global namespace to one class: analogClock.
Example of use:
The div tag is not replaced in this custom element, but instead is used as a pseudo-document to hold the clock itself. The 'hands' are implemented using arrays of generated divs.
I was actually inspired to write this widget because of an article on About.com's Javascript pages written by a guy named Stephen Chapman. His code was a mess, but I only discovered this after delving through two layers of 'unescape()' obfuscation.
The basics: You control the look of the numbers and the 'box' model of the clock using basic CSS. You control the clock's size (it will always be square) using the 'size' attribute.
The 'seconds', 'minutes', and 'hours' attributes are for the color of the 'hand's. 'numstyle' can be 1, i, I, or '.', each refering to a different type of face-numbering for the clock
The 'localzone' attribute tells the script to use the user's local time zone. If it's '0', 'false' or 'no', the clock will use the 'clockzone' attribute to determine what time it is (the clock zone is relative to GMT, so, for example, US Eastern is -5. The clock automagically figures out if we're in DST, so you don't have to.)
The 'city' and 'country' are for if you want to put in the city/country of origin for your clock. To be honest, you can put anything there.
Lastly, I designed my version of the clock to be able to not 'tick', i.e., work like the old-school analog clocks. If you want ticking, add 'tick=1' to the attribute list
As with all of my widgets, the idea here is that you can just include the .js file and start dropping in tags without needing to know any ECMAScript at all.
Additionally, for you ECMAScripters, I was very careful to keep my pollution of the global namespace to one class: analogClock.
Example of use:
26
The basic framework of an Ajax-enabled web page. The following JavaScript shows how to send a request for an XML file and how to receive that request. Of course, in a real life scenario, you'll have to implement better error trapping and actually do something with the XML that gets returned.
11
I use this in my AJAX as a quick way to get the Value of the selected item in a Select HTML object. If nothing is selected, it returns zero.
(May be basic to y'all, but maybe really usefull to someone else).
(May be basic to y'all, but maybe really usefull to someone else).
12
A simple Tooltip for you web pages with minimal code.
Images , Text and HTML code can be shown inside the tootip
Images , Text and HTML code can be shown inside the tootip
12
Here's a simple JavaScript solution to hide your e-mail from many spam scripts while still providing clickable hyperlinks to your visitors.
Web crawlers and visitors with JavaScript disabled will see: me [at] mydomain [dot] com. I've seen a lot of people that just leave it at this, but it seems a bit unprofessional in my opinion. With the following code, we can replace that with a fully functional hyperlink.
Web crawlers and visitors with JavaScript disabled will see: me [at] mydomain [dot] com. I've seen a lot of people that just leave it at this, but it seems a bit unprofessional in my opinion. With the following code, we can replace that with a fully functional hyperlink.
13
It works with Array types. The example is a simple list of numbers, but the array could contain anything; lists of strings, functions, DOM nodes, whatever. Unfortunately, a lot of things that seem like arrays in the DOM aren't really, so you can't shuffle the images on a page with just document.images.shuffle() all by itself.
12
Similar to Perl's CGI::escapeHTML(), though (because we can!) this adds it as a method to all String objects.
-9
Strips all tags from any string.
10
Gives you control to perform actions when the control key and the mouse button is clicked in the same time. Something similar to selecting elements in Windows with ctrl+click.
Just change the event.ctrlKey to event.shiftKey to make it shift+click. If you don't get it don't worry the snippet contains the demo for shift+click too.
You may need to change the event.which though 1 = left click, 2 = middle click, 3 = right click(at least in firefox 1.5.0.5)
Just change the event.ctrlKey to event.shiftKey to make it shift+click. If you don't get it don't worry the snippet contains the demo for shift+click too.
You may need to change the event.which though 1 = left click, 2 = middle click, 3 = right click(at least in firefox 1.5.0.5)
13
Trim , Left trim (ltrim) and Right Trim (rtrim) in javascript









