See what's going on with flipcode!




This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

 

  JavaScript Bookmarks
  Submitted by



Something you can do with IE's bookmarks (This may wotk with other browsers too, haven't tried) is embed JavaScript in them. To see this in action, do the following:
  • Create a new short-cut (Right-click in a folder, New -> Shortcut). This starts a wizard.
  • In the location-box, enter a valid url (for instance http://www.flipcode.com) and click next.
  • Name the shortcut "dictionary" and click finish.
  • Right-click on the newly created shortcut and select "properties".
  • Replace the URL with: javascript:Qr=document.selection.createRange().text;if(!Qr){void(Qr=prompt(' Query...',''))};if(Qr){void(window.open('http://www.dictionary.com/search?q= '+escape(Qr)))}
  • You may get a warning, which you can ignore.
  • Drag the shortcut onto your "Links" toolbar in IE.


  • Now you can select a word in the currently loaded HTML-document, click the dictionary shortcut and you will go straight to a dictionary site with the selected word as search parameter.

    Anyone who knows some JavaScript can use this trick to do really neat things I'd say.

    The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

     

    Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
    Please read our Terms, Conditions, and Privacy information.