This article introduces the commonly used page jump implementation methods, including the JS php asp.net these three kinds of implementation code, there is a need to understand friends can refer to.
First to introduce the practice of JS
The code is as follows |
Copy Code |
function Tourl (UL) { if ("" = = UL | | Null==ul) { Alert ("Thank you for attention"); }else{
WINDOW.OPEN (UL);//This is a new window. window.location.href=ul;//This is directly on the current page jump } Return } |
This is a window.open to achieve, click to pop a window Oh,
JavaScript Popup selection box jump to other pages
The code is as follows |
Copy Code |
<script language= "JavaScript" > <!-- function logout () ... { if (confirm) ("Are you sure you want to cancel your identity?") Yes-Select OK, no-select Cancel ") ... { window.location.href= "Logout.asp?act=logout" } } --> </script> |
Will prompt the user whether to confirm to pass out, if clicks is to be able to jump to logout.asp?act=logout this page.
Take a look at using HTML Refresh to jump
The code is as follows |
Copy Code |
<?php $url = "http://www.3ppt.com"; if (!isset ($url)) { Exit (' No address to jump '); } ?> |
<meta http-equiv= "REFRESH" content= "5; Url= ' <?php echo $url;? > ' ">
It's going to jump to http://www.3ppt.com in 5 seconds.
The code is as follows |
Copy Code |
PHP header () to implement the <?php $url = "http://www.3ppt.com"; if (Isset ($url)) { Header ("Location: $url"); } ?> |
One thing to be aware of when using the PHP header is that there must be no output before, otherwise it will go wrong (PHP header () usage).
asp.net jump method
The code is as follows |
Copy Code |
Response.Redirect ("index.aspx"); This is much more convenient. |