hi there ...
I want my page to redirect to another page by using response.redirect method ... but I want the redirection to be done after 10 seconds ... any help?
Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.
hi there ...
I want my page to redirect to another page by using response.redirect method ... but I want the redirection to be done after 10 seconds ... any help?
You can try the following script to do auto redirecting but it is not using asp. If you wish you can make use of this code.
Code:<HTML><HEAD> <!-- Begin ReDirect Command --> <!-- Re-Direct Page JavaScript Code --> <meta http-equiv="refresh" content="10;url=http://www.abcxyz.com"> <!-- End ReDirect Command --> </head> <BODY BGCOLOR="#ffffff"> <div align="center"> <center><table border="0" width="290" height="156"><tr><td width="65%"></td><td width="35%"><p align="center"><font face="ms sans serif" size="4" color="#000000"><b>Your Code<br>Demonstration</b></font><br><input TYPE="button" VALUE="Close" onClick="window.close()"></td></tr></table></center> </div> </BODY> </HTML>
This Function can also be called in the ASP part for page redirection., (2*1000 = 2 seconds)
Code:function doRedirect() { setTimeout( "window.location.href = sTargetURL", 2*1000 ); }
Can you give me an example where this function is used ... thanks
You can use this function in OnLoad event of Body tag
Code:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Auto Redirect</title> <script language =javascript > function doRedirect() { setTimeout( "window.location.href = 'http://www.abcxyz.com'", 2*1000 ); } </script> </head> <body onload="doRedirect()"> Hello </body> </html>
Here is one you can use. It is all Javascript but has a nice little count down to show the user they are about to be redirected.
Change the variable counts to whatever interval you need. Then change "location.href=" to whatever address/page you want them to go to.Code:<html> <head> <title></title> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var start=new Date(); start=Date.parse(start)/1000; var counts=45; function CountDown(){ var now=new Date(); now=Date.parse(now)/1000; var x=parseInt(counts-(now-start),10); if(document.form1){document.form1.clock.value = x;} if(x>0){ timerID=setTimeout("CountDown()", 100) }else{ location.href="http://www.vaasinc.com" } } // End --> </script> <SCRIPT LANGUAGE="JavaScript"> <!-- window.setTimeout('CountDown()',100); --> </script> </head> <body> <table border="0" width="750" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111"> <tr> <td width="643" style="color: #000000; font-family: Arial; font-size: 10pt" bgcolor="#FFFFFF" valign="top"> <p align="center"> <FORM NAME="form1"> <p align="center"> You will be redirected in <INPUT TYPE="text" NAME="clock" SIZE="1" VALUE="10" style="color: #FF0000; font-size: 10pt; font-weight: bold; text-align: center"> seconds. </p> </FORM> </td> </tr> </table> </body> </html>
Hope this fits the need.
- Olórin
Code:<% Response.AddHeader "Refresh", "10;url=http://aspfree.com/" %>
Thank you guys for your help
Become Part of This Conversation
Join NowFor Free!
Comments on this post