JavaScript & HTML Tips
Feature highlight: Using Bookmarklets
Bookmarklets Website; some modified by JBS

Bookmarklets are small pieces of JavaScript code that can do useful work in a short space

Bookmarklets can be added to any tag that has a href= reference. The bookmarklets look like this simple Hello World example:
<a href="javascript://some few lines of javascript code>Template</a> or to be specific -

<a href=javascript:alert('Hello World');>Hello World</a> becomes this:
Hello World

The red template shows how bookmarklets work in general. We have used the a-anchor tag here but it could just have well been a div or span. The best way to understand bookmarklets is to try a few and see how they work:

Go To Random Link

Previous Page in New Window

Show Occurrences of Word..

Resize Window to Full Screen

Setup 4 Windows

List All Links

Send Location by eMail

Number of Words in Selection

216 Standard Colors


Key features
The nice thing about bookmarklets is not only that they illustrate tight coding in JavaScript; but also they can be bookmarked and then used over and over again in your browser - in effect adding to its usability. Here is how to do it:

In Internet Explorer: Right click directly on the bookmarklet; then select Add to Favorites...

In Netscape: Right click again directly on the bookmarklet; then select Add Bookmark

Its a classic case of marketing - Try them, you'll like them.


Top of Page  Tutorials Home  Javascript References  JavaScript Books