网页转向代码
<meta http-equiv="refresh" content="3; url=qingmo.htm">在HTML的与之间加入下面这段代码,则在3秒钟之后正在浏览的页面将会自动变为target.html这一页。代码中3为刷新的延迟时间,以秒为单位。qingmo.htm为你想转向的目标页,若为本页则为自动刷新本页。
javascript/dhtml
用meta标签完成
<meta http-equiv="refresh" content="1;url=http://www.qingmo.net">
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title></title>
</head>
<body>
<form name=loading>
<P align=center><FONT face=Arial color=#0066ff size=2>loading...</FONT> <INPUT
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-WEIGHT: bolder; PADDING-BOTTOM: 0px; COLOR: #0066ff; BORDER-TOP-style: none; PADDING-TOP: 0px; FONT-FAMILY: Arial; BORDER-RIGHT-style: none; BORDER-LEFT-style: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-style: none"
size=46 name=chart> <BR><INPUT
style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BORDER-LEFT: medium none; COLOR: #0066ff; BORDER-BOTTOM: medium none; TEXT-ALIGN: center"
size=47 name=percent>
<script>
var bar=0
var line="||"
var amount="||"
count()
function count(){
bar=bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.percent.value=bar+"%"
if (bar<99)
{setTimeout("count()",100);}
else
{window.location = "将这里改成要转入的网址";}
}</script>
</P></form>
</body>
</html>
-------------------------------------------------------------------------------
不隐藏转向之后的地址 代码二
-------------------------------------------------------------------------------
<html>
<body>
<script language="javascript">
<!--
function goToURL() { //v2.0
for (var i=0; i< (goToURL.arguments.length - 1); i+=2) //with arg pairs
eval(goToURL.arguments+".location='"+goToURL.arguments+"'");
document.returnvalue = false;
}
//-->
</script>
<body bgcolor="#FFFFFF" onLoad="goToURL('parent','将这里改成要转入的网址');return document.returnvalue">
</body>
</html>
-------------------------------------------------------------------------------
不隐藏转向之后的地址 代码三
-------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title></title>
</head>
<script LANGUAGE="javascript">
<!-- Start Code
var ver = navigator.appVersion;
if (ver.indexOf("MSIE") != -1)
{
window.location.href="将这里改成要转入的网址"
}else
window.location.href="将这里改成要转入的网址"
// End Code -->
</script>
</html>
-------------------------------------------------------------------------------
不隐藏转向之后的地址 代码四
-------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title></title>
</head>
<body>
<meta http-equiv="refresh" content="0.1;url=将这里改成要转入的网址">
</body>
</html>
-------------------------------------------------------------------------------
可隐藏转向之后的地址
-------------------------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
<title></title>
</head>
<frameset framespacing="0" border="0" rows="0" frameborder="0">
<frame name="main" src="将这里改成要转入的网址" scrolling="auto" noresize>
</frameset>
</html>
弹出新窗口
1.
<script language="javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
window.open('http://dielian.net','dielian');
//-->
</script>
2
<script language="javascript">
<!--
var gt = unescape('%3e');
var popup = null;
var over = "Launch Pop-up Navigator";
popup = window.open('', 'popupnav', '');
if (popup != null) {
if (popup.opener == null) {
popup.opener = self;
}
popup.location.href = 'http://dielian.net/';
}
// -->
</script>
ASP的:
<%
if Request.ServerVariables("SERVER_NAME")="www.qingmo.net" then
response.redirect "default.asp"
else
response.redirect "default_en.asp"
end if
%>
此ASP代码功能是当两个域名指向同一个主机时,可以自动重定向到相应的域名网站
或者:
用redirect方法
转向到 http://你的站点/news
<%
response.redirect "http://"&Request.ServerVariables("SERVER_NAME")&"/news"
%>
PHP的:
PHP一般是用 header函数
重定向到 http://www.qingmo.net
<?php
header("Location:http://www.qingmo.net");
?>
或者:
<? header("location:note.php"); ?>
页:
[1]