Reputation: 63
I must use a proprietary software for the project. In this software there is part that generates mobile surveys. In the mobile survey mode i have access only to the css... no html, no javascript.
However i find out that i can run javascript from <a href="javascript:CODE">
, executes on click on that element.
I need to create custom button that acts like the forward button, but do some other stuff as well.
The code that i'm using is:
<a id="theNavButtons" href="javascript:document.getElementById('q1_1_content').parentNode.getElementsByTagName('a')[4].click()" > >>> </a>
If I test this using alert and changing .click() with .innerHTML I see that I get the correct element (the forward button on the page). I also tested .click() on some other elements and it is working, but for this element it is not.
Here is a demo link, it is in mobile mode, click forward once to see the second page: http://author.euro.confirmit.com/extwix/extquicktest_p1839573894.aspx?__qtkey=c2c45e09c13b427b925611227091e3cd&l=29&__rm=2
I tried exploring the events connected to the forwadbutton, but there is too much custom code there...
Please give me some ideas...
Upvotes: 0
Views: 203
Reputation: 63
I figure it out on my own.
The thing is that the system was wrapping everything in a form element.
Using document.forms[0].submit() on the a element did the trick :)
Have a nice day, Rado
Upvotes: 1