PDA

View Full Version : Executing click event via JS



fsa3
11 Jul 2009, 12:11 PM
Here is my (somewhat unique) situation. I have a link (anchor) in my main HTML body (let's call it "login link"). The link's onClick event is set by a 3rd party script. I have some Ext code that opens up a panel where I want to have a link that performs the same function as login link. So what I was trying to do was in the JS that executes when my panel's button is clicked was something like:



var link = Ext.getDom('loginlink');
link.click();


Now I know this is wrong and doesn't work - but hopefully it conveys what I'm trying to do. I want to execute the click event on the anchor even though it's not being directly clicked.

Any idea how to do this?
Thanks.

analpaper
11 Jul 2009, 2:19 PM
It may help a bit if you post your link (a element), but.. did you try..

eval(document.getElementById('loginlink').getAttribute('onclick'));