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

Link to comment
Share on other sites

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.. 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.