-2

The HTML of the page I wish to use for this is as follows:

<A HREF= "http://www.example.com"
        TARGET="_new" status="Home Directory" title="Home Directory" 
        urn="Home Directory" FOLDER="http://www.example.com"><IMG align=textTop border="0" src="images/buttons/mywork.gif" alt="Select this icon to show your Home Folder" ></td>

How can I simulate a click on this hyperlinked image just using Javascript? I don't have edit privileges for this page so I need to work with what I have already got in the page (above)

r3dd3x
  • 23
  • 5

3 Answers3

0

You can use firebug plugin for firefox and code your javascript from the console. Google chrome also has a console.

Jorge Zapata
  • 2,316
  • 1
  • 30
  • 57
0

Give it an id for a start and then invoke using "apply"

var x = document.getElementById("linky");
x.onclick.apply(x);
Peter Kelly
  • 14,253
  • 6
  • 54
  • 63
  • Did you read my question properly? I put **I don't have edit privileges for this page so I need to work with what I have already got in the page** - please provide some code which works with the existing code without have to add anything (such as an ID tag) – r3dd3x Jan 31 '12 at 21:01
  • Also, it's the only A HREF link on the page, so maybe I could find all A HREF links on the page and click on the first one using Javascript? – r3dd3x Jan 31 '12 at 21:02
0

I would use the jQuerify plug-in. Then type $('a').click(); in the Firebug console.

JoshNaro
  • 2,047
  • 2
  • 20
  • 40