NetTalk Central

Author Topic: Programmatically triggering Onclick event using client-side  (Read 19711 times)

Trevor Dickson

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Programmatically triggering Onclick event using client-side
« on: April 02, 2008, 05:47:49 AM »
Hi There

Im hoping someone can help me with a problem I've encountered.

My brief is to build a program that can be run client-side to automate some web tasks.  So on loading, the application will navigate to the webpage in question and wait.  The user then clicks a button which scans through all the elements in the html document and finds the ones matching a specific ID, which it then iterates through and simulates a mouse click on them.

The code works pretty well In Nettalk opening the site, retrieving the code and the searching through it and works well on buttons, forms etc on most sites, but won't trigger this event below...


And here's the html segment that's relevant:

Code Block
<a style="cursor: pointer;" onclick="fbjs_sandbox.instances.a2437228683.bootstrap();return fbjs_dom.eventHandler.call([fbjs_dom.get_instance(this,2437228683),function(a2437228683_event) {a2437228683_doajax('diggComment3432030', 'http://74.86.142.204/~asd/asd/asd.php?cid=3432030&up=1&sd=0&poster=749701787&herd=1', '')},2437228683],new fbjs_event(event));return true">
<img src="
The code works pretty well on buttons, forms etc, but won't trigger this event...">http://x.x.x.x/%xx/xx/images/thumbsup.jpg</A< A>>" height="30" width="30"></a><br>

Any suggestions would be appreciated as I can't get it to trigger the onclick event for that code segment.

Thanks

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Programmatically triggering Onclick event using client-side
« Reply #1 on: April 02, 2008, 08:06:29 AM »
Hi,

almost certainly the javascript is triggering an asyncronous GET. So you'd do a well-formed GET to simulate this. Probably with the header tweaked.

The best way to see it is to use a packet sniffer (Ethereal etc) to "see" the request if you do it manually. Pay attention to the headers.

Cheers
Bruce

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
Re: Programmatically triggering Onclick event using client-side
« Reply #2 on: April 03, 2008, 05:39:10 AM »
JAT -
I may be missing the point, but how about putting all that code in a function and just call the function from the OnClick. That way anything that needed to could call the function rather than pushing an Onclick event.

Chris C.

Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Programmatically triggering Onclick event using client-side
« Reply #3 on: April 03, 2008, 07:38:57 AM »
You're thinking web Server Chris, whereas in this case it's web client...

cheers
Bruce