-1

I have code:

<a href="#" onclick="call(8969)" id="btn" class="zoombox"></a>

When I click button, this code will execute. Now, I want it is execute automatically when I visit website. How to do that ? Thank you very much !

HangKo
  • 31
  • 3
  • Use on load: [http://stackoverflow.com/questions/807878/javascript-that-executes-after-page-load][1] [1]: http://stackoverflow.com/questions/807878/javascript-that-executes-after-page-load – Frank_Vr Mar 26 '14 at 06:14

2 Answers2

1

Using jQuery trigger event, you can do this:

window.onload = function(){
     $('#btn').trigger('click')   
 }
sanman
  • 770
  • 1
  • 7
  • 15
0

The onload event should suffice, otherwise, use JQuery.

<body onload="call(8986);" ...>
Luke Joshua Park
  • 9,527
  • 5
  • 27
  • 44