I’m trying to automate clicking a few links on a webpage
For example, in Google Chrome if I type Javascript:setDisplayType('source'); then it runs the function in the html defined as
<input type="radio" name="DisplayType" value="source"
onclick="setDisplayType('source');">
So far so good. However, I’m unsure about how to do the same with the following
<td id="4124321351_U923" class="o bgc b" onclick="s(this,'329803656','40745906','9/2');b(this,'5.5','5.5');">5.5</td>
I’ve tried the following without success
Javascript:s(this,’329803656′,’40745906′,’9/2′);
Javascript:b(this,’5.5′,’5.5′);
Javascript:s(this,’329803656′,’40745906′,’9/2′);b(this,’5.5′,’5.5′);
Please can someone explain why it’s not working and how to fire this onclick event using a similar method?
if you’re not using JQuery or similar, then something like:
might work. In short, your examples above don’t work because the ‘this’ magic variable needs to be initialised to point to the link being clicked. You could either try to initiate a click event on the element (as per my example) or you could manually grab a reference to the link, and pass that in instead of this