SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Dec 2000
    Location
    BOSTON MA
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi, i'm not sure that this qualifies to be in this particular forum but here goes.

    you know how google has that add google search button to your browser feature?

    well, would it be possible to make such a button or link or script for other search scripts that exist?

    does anyone know what would be involved? as far knowing how the script would work and everything?

    i just think that it would be cool to have that and be able to search another search enginge just by highlighting text in the browser and clicking search as you would with google.
    . . . chris

  2. #2
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's certainly possible, and relatively painless. I borrowed Google's code as a starting point, and changed it up a bit. I use it for highlighting an address on a web site that links to a map of that address via Yahoo Maps. I don't have that example with me, but here's an example that takes the highlighted text and searches Yahoo:

    <html>
    <head>
    <title>Untitled</title>
    </head>

    <body>

    <a href="javascript:q=(document.frames.length?'':document.selection.createRange().text);for(i=0;i<document.frames.length;i++){q=document.frames[i].document.selection.createRange().text;if(q!='')break;}if(q=='')void(q=prompt('Enter text to search using Yahoo. You can also highlight a word on this web page before clicking Yahoo Search.',''));if(q)location.href='http://search.yahoo.com/bin/search?p='+escape(q)"><font size=+1>Yahoo Search</font></a

    </body>
    </html>

    To install the button, view the page above in your browser, and drag the link to your shortcut bar. You may be warned that adding the link may not be safe (since you're adding a shortcut to a script), best rest assured the script above is safe. Have fun.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •