Hi guys,
I've got a script that is working with linked text but I want it to work with both already linked text <a href> and user selected text.... in Firefox by the way (It's gonna be a FF addon)
Here's how I'm calling the function -
and here's the (working) function that uses a hyperlink -Code:<menuitem id="myid" label="MyLabel" accesskey="C" insertafter="context-stop" oncommand="myFunction();"/>
Here's the code for the user selected portion that I want to integrate.Code:function myFunction() { try {url = gContextMenu.linkURL} // new FF, other? catch(e) { try {url = gContextMenu.linkURL()} // old FF, SM, other? catch(e) {url = String(gContextMenu.link)} // either FF, other? } window.open('http://myurl.com/file.php?url=' + url, 'window name') }
Is it possible to do it in one function or do I need two - in which case is it possible to call 2 functions simultaneously?Code:function foo() { var selObj = window.getSelection(); alert(selObj); var selRange = selObj.getRangeAt(0); // do stuff with the range }



Reply With Quote


Bookmarks