You can sort of do what you want in a cross-browser fashion. Kind of.
Create a new bookmark in the links toolbar on your browser with the
following code as the url:
javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('http://blah/cgi-bin/foo?text='+escape(Q),'text
selection bookmarklet',
'scrollbars=no,width=480,height=300,left=100,top=150,status=yes'));
(that should be all on one line!)
Now, highlight some text on your page, hit the link you created in your
toolbar and up will pop a new window with your selection in the URL.
Oh, all this ripped from the b2 "blog this" popup code by someone else,
it should work but I haven't tested it.
Donncha.
Peter Flynn wrote:
> I know this is OT, but is there a Javascript expert out there?
> I need to know if it is possible to write a JS function which will
> send a user-highlighted text string from a Web page as the argument
> of a script URL. That is, the user double-clicks an arbitrary word
> (not a link) and a menu drops down out of nowhere and the user
> clicks 'Send' and the JS invokes a new page to
>http://blah/cgi-bin/foo?text=thestring>> I have very conflicting reports on whether this is actually possible
> and I can't find a response from anyone authoritative.
>
--
Holy Shmoly! - http://blogs.linux.ie/xeer/
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!