Jump to content

Running links and buttons automatically when page loads


bleustreak12

Recommended Posts

Hi,

I have some effects right now which come up only when someone clicks on a Hyperlink or a button.

 

I want the same thing to happen when the page loads automatically without somebody clicking on the link.

How can I run a button or a hyperlink on body onload function(i.e when page loads).

 

Is there any other way to run a link or button when page loads

 

can you provide me examples

That all depends on what you want to happen, exactly.  What is it that the button does, for instance?  Have you tried taking the onClick results (e.g. what happens when you click the button) and applying them in a script in the onload section?  You can also use jQuery and run it inside a script tag and 

$(document).ready(function(){
//fire the jQuery events here
};

 

Using that method will wait until the page is finished loading first before firing the events so that you don't get unexpected results or modify something that technically doesn't exist in the page yet.  If you use onLoad and modify content you run the risk of trying to modify stuff the browser doesn't know about yet.. 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.