I have spent 2 days googling to find a cross-browser solution to simulate a mouse click on an html <a>, but have yet to find a one.
//-- REGARDING javascript's fireEvent (for IE browsers)
var lvs_event = 'click' ;
var lvo_event = document.createEventObject();
argo_target.fireEvent( 'on' + lvs_event , lvo_event );
//-------- does not work on either my winXP IE6 or my winVista IE8
//-- REGARDING javascript's dispatchEvent (for non-IE browsers)
var lvo_event = argo_target.ownerDocument.createEvent('MouseEvents') ;
lvo_event.initMouseEvent( 'click' , ... ) ;
argo_target.dispatchEvent( lvo_event ) ;
//-------- does not work on winVista FF3.6
//-- REGARDING inserting location.href
<a href = '...'
target = '...'
onclick = '...;location.href = this.href;...'
>
<script>
my_a.onclick();
<\/script>
//-------- works consistently BUT literally calls the onclick handler, ignoring all other <_a_> properties such as href and target
//-- REGARDING various jQuery solutions
$('#my_a').trigger('click');
//OR
$('#my_a').click();
//-------- does not work on any browsers (jQuery IS successfully being used for other features however)
MY GOAL: for a flash button mousedown to relay message to js, which in turns automates a <a> click process.
I can of course let flash call js, get the necessary html info from js and return it to flash, which can then do a as3 geturl, but I would prefer to tie into my existing html environment process.
I am currently testing using various versions of ff, ie, opera, safari(for win), chrome on winXP and winVista.
$('#my_a').trigger('click');should work, don't know why it isn't working...