探討PHP頁面自動跳轉(zhuǎn)的實現(xiàn)方法
PHP頁面自動跳轉(zhuǎn)的實現(xiàn)對于PHP新手來說還是比較陌生的,希望通過對本文的理解,能夠提高我們的實際編程能力,對PHP頁面自動跳轉(zhuǎn)的實現(xiàn)方法有一個深刻的了解。#t#
1.meta 標簽實現(xiàn)跳轉(zhuǎn):
<meta http-equiv="refresh" content="秒; url=下一個頁面">
2 .JavaScript實現(xiàn)跳轉(zhuǎn):
- < script language="JavaScript">
 - var userAgent = navigator.userAgent;
 - var MSIEIndex = userAgent.indexOf("MSIE");
 - if (userAgent.indexOf("Win") != -1 &&
 - userAgent.indexOf("MSIE") != -1 &&
 - userAgent.substring((MSIEIndex + 5),(MSIEIndex + 8)) >= 5.5)
 - window.location.replace("http://www.shuigong.com");
 - //-->
 - < /script>
 
3 假如訪問網(wǎng)站時,直接進入某個子目錄中的文件,如cgi-bin/leoboard.cgi,這時,只要寫一個默認的首頁文件如index.htm,內(nèi)容如下,就可以實現(xiàn)你的要求.
PHP頁面自動跳轉(zhuǎn)方法一:
- < html>
 - < head>
 - < title>網(wǎng)頁跳轉(zhuǎn)< /title>
 - < meta http-equiv="refresh" content="0;url=cgi-bin/leoboard.cgi">
 - < /head>
 - < body>
 - < /body>
 - < /html>
 
PHP頁面自動跳轉(zhuǎn)方法二
- <html>
 - < head>
 - < title>正在進入>>> Loading>>> < /title>
 - < /head>
 - < body bgcolor="#FFFFFF" text="#000000">
 - < p> < /p>< tr> <td width=724>
 - < p align=center><font color="red" size="2">
 
正在進入,請等待,謝謝......< /font>< /p>< /td>< /tr>< tr>- < td width="724">
 - < p align=center>
 - < form name=loading>
 - < div align=center>
 - < p>
 - < input type=text name=chart size=46
 
tyle="font-family:Arial; font-weight:
bolder; color:rgb(124,119,119);
background-color:white; padding:0px;
border-style:none;">- < br>< input type=text name=percent
 
size=46 style="color:rgb(138,134,134);
text-align:center; border-width:medium;
border-style:none;"><script>var bar = 0- var line = "||"
 - var amount ="||"
 - count()
 - function count(){
 - barbar= bar+2
 - amountamount =amount + line
 - document.loading.chart.value=amount
 - document.loading.percent.value=bar+"%"
 - if (bar<99)
 - { setTimeout("count()",10); }
 - else
 - { window.location = "http://www.wwwfox.net/cgi-bin/leoboard.cgi"; }
 - }< /script>
 - < / body>
 - < /html>
 
實現(xiàn)PHP頁面自動跳轉(zhuǎn)的代碼
1:
- < script language="j avascript">
 - location.replace
 
("http://www.***.com")- < /script>
 
2:
- < script language="j avascript">
 - setTimeout(window.location=
 
"http://www.dinmo.net",0)- < /script>
 
3:
- < script language="JavaScript" >
 - bName = navigator.appName;
 - if ((bName == "Netscape") ||
 - (bName == "Microsoft Internet Explorer"))
 - window.location=http://www.dinmo.net;
 - < /script>
 - < FRAMESET rows=\'*\'>
 - < FRAMESET cols=\'*\'>
 - < FRAME SRC=\'http://www.dinmo.net\'>
 - < noframes>
 
JS實現(xiàn)跳轉(zhuǎn)代碼_多域名指向同一空間
- < script>try { if( self.location == "http://玉米一/" ) {
 - top.location.href = "http://玉米一/目錄";
 - }
 - else if( self.location == "http://玉米二/" ) {
 - top.location.href = "http://玉米二/目錄";
 - }
 - else if( self.location == "http://玉米三/" ) {
 - top.location.href = "http://玉米三/目錄";
 - }
 - else if( self.location == "http://玉米四/" ) {
 - top.location.href = "http://玉米四/目錄";
 - }
 - else { document.write ("錯誤的訪問地址") } } catch(e) { }
 - < /script>
 















 
 
 
 
 
 
 