日期:2014-05-17  浏览次数:20431 次

各位大个,,小弟正在学这个php跳转代码,,,在所有的浏览器测试都可以跳转,,但在firefox浏览器就不会自动跳转,,因为是用到JS实现的.
各位大个,,小弟正在学这个php跳转代码,,,在所有的浏览器测试都可以跳转,,但在firefox浏览器就不会自动跳转,,因为是用到JS实现的.

Get_admin_msg("list.php","登录成功!");

function Get_admin_msg($url,$show)
 {
  $msg='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  <title>管理区域</title>
<script type="text/javascript">
  t = -1; // 计数器
  setInterval("testTime()",1000); // 启动1秒定时
  function testTime() {
  if(t<0) return; // 计数器值小于0,表示尚未开始倒计时
  if(t == 0) // 计数器值为0,转向
  location = "'.$url.'";
  view.innerHTML =t; // 显示倒计时
  t--; // 计数器递减
  }
  </script>
  <style type="text/css">
body{ font-size:12px;}
  #man_zone{ width:500px; margin:0px auto;}
.table td{ text-align:center;}
.table p{ padding:0px; margin:0px; height:5px;}
.zt{color:#f30; font-weight:bold;}
a{color:#f30;text-decoration:none;}
  </style>
  </head>

  <body onload="t=5">
<div id="man_zone">
<table width="100%" border="1" align="center" cellpadding="0" cellspacing="0" class="table">
<tr>
<td align="center" style="background:#cef">信息提示</td>
</tr>
<tr>
<td><p><samp style="color:#f30;">'.$show.'</samp></p><br />
<p><span id="view" class="zt">5</span>&nbsp;秒钟返回指定的页面!</p><br />
如果浏览器无法跳转,<a href="' .$url.'">请点击此处!</a>
</td>
</tr>
</table>
</div>
  </body>
  </html>';
  echo $msg;
  exit();
  }

------解决方案--------------------
view.innerHTML =t; // 显示倒计时 => 
document.getElementById("view").innerHTML =t; // 显示倒计时

建议装个 firebug