1 Reply Latest reply on Dec 11, 2012 7:33 PM by George_Johnson

    Get the selected link

    frameexpert Level 4

      I have a link on a page selected with the link or object selection tool. Is there any way to return the selected link with JavaScript? I need to change the action on a few links, and I would like to do it interactively by selecting a link then running my JavaScript code from the console. Any help would be appreciated.

       

      Rick

        • 1. Re: Get the selected link
          George_Johnson MVP & Adobe Community Professional

          Hmmm...only in an indirect way. Through JavaScript you can get the current mouse position (doc.mouseX, .mouseY) and also get an array of all of the links on the current page. For each link that's returned with the doc.getLinks method you can examine its rect property. If the mouse coordinates are within the rect, than you could count that as it being selected, and then set its action to something else. You'd have to position the mouse, bring up the JavaScript console (Ctrl+J) and run your code. That's all I got.