dimanche 29 mars 2015

JavaScript; trying to fire a click within a and and but not till the is called

Sorry if this is such a 'newbe' question, been fighting this for a while...


Seeking to fire an [a href] from within a tag.


Found several ways to do it, however.. the entire script is with-in an [ul], so script to "click" the [a href] occurs on load of index.html, not when the specific tag is called.


Sorry if confusing; here are some snippets of code that may help explain.


[ul id="menu"]


[!-- several [li] to other parts of the site, then: --]


[li][a href="#!/WORKHISTORY" onclick="ga('send','event','Internal Links','Work History')"][span class="over"][/span>


[/ul]


Followed by: an [article] and a [ul]


Within the [ul], is a tag referencing the "workhistory" tag.


[li id="WORKHISTORY"] [div class="box"] [a id=wrkhst1 href="/gallery/1426894494/1426894576.jpg" rel="prettyPhoto[1426894494]"][span class="over"][/span][/script][/a] [/div] [/li]


I have tried to use [script]document.getElementById('wrkhst1').click();[/script] Which works.. however it fires at the load of index.html, not with the click of the parent [li], as it reads the main index page and loads it...


I tried the same script this in the and not using the tag, but same result.


I am sure this is quite simple, and prob should have sought help sooner !


Appreciate any help!


Larry


PS the site is for my resume, and can be found at: http://ift.tt/1F6m0x4


Aucun commentaire:

Enregistrer un commentaire