User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 401,670 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,532 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 4576 | Replies: 1
Reply
Join Date: Mar 2005
Location: LTT, South Africa
Posts: 125
Reputation: william_stam is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

delayed page refresh when link is clicked

  #1  
Mar 10th, 2005
Hi all

I need help. How and what is the code to have a page refresh once a link is clicked the problem is that this needs to be delayed for a few seconds.

this is similar to <meta http-equiv="refresh" content="5"> but only if the link is clicked is there this.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: delayed page refresh when link is clicked

  #2  
Mar 10th, 2005
<HTML>
<HEAD>
	<SCRIPT LANGUAGE="Javascript">
		url = "http://www.daniweb.com";
	</SCRIPT>
<BODY>
<A HREF="#" onClick="setTimeout('window.location = url', 5000);">Some Link</A>
</BODY>
</HTML>

This should effectively delay the page change by 5 seconds. If you want to change the number, it is in milliseconds, so 1 second is 1000. Also, all you have to do is change the variable url, in the header portion of the page to whatever you want your page redirected to.

In order to do a refresh... you can just the url variable to whatever page you want to refresh. If I'm not mistaken (which I could be) there should be a reload() function that you could use intead of the window.location, but not 100% that it is cross-browser compliant.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 7:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC