Here's some getSelection code that works on most modern browsers:
http://www.quirksmode.org/js/selected.html
> -----Original Message-----
> From: Code for Libraries [mailto:[log in to unmask]] On
> Behalf Of Riesner, Giles
> Sent: Thursday, January 13, 2005 01:38 PM
> To: [log in to unmask]
> Subject: Re: [CODE4LIB] Help with bookmarklet
>
> I'm not sure what you mean about the object not existing.
>
> The code I sent worked with the exception of putting the word
> "undefined" into the prompt box (which I felt would be
> confusing to patrons).
>
> Breaking up the selection as you did, doesn't work -- but
> thanks for the suggestion.
>
> --Giles
>
>
>
> -----Original Message-----
> From: Code for Libraries [mailto:[log in to unmask]]On
> Behalf Of Art Rhyno
> Sent: Thursday, January 13, 2005 2:49 PM
> To: [log in to unmask]
> Subject: Re: [CODE4LIB] Help with bookmarklet
>
>
> Is it just that the object doesn't exist? You could do something like:
>
> <a
> href="javascript:if(document.getSelection.text)Qr=document.get
Selection.text;else
> Qr='';Qa=prompt('Author...',Qr);Qt=prompt('Title...',Qr);if(Qa
> &&Qt)location.href='http://library.ccbcmd.edu/search~S4/q?auth
or='+escape(Qa)+'&title='+escape(Qt)">Combined
> Author and Title...</a>
>
> in Firefox, I think you need to break up the getSelection to
> work in IE.
>
> art
>
|