1.返回上一页的时候自动刷新
<body onunload="self.location.reload()">
onclick="javascript:window.open('news_edit.asp','_self')"
2.简单的自动跳转
<meta http-equiv="refresh" content="time;URL=your url">
time 【自动跳转的时间,比如:2,则代表2秒后自动跳转】
your url 【要转向的超链接】
3.无效连接转移
<script language="javascript">
function getURL(url)
{
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET",url,false);
xmlhttp.send();
if (xmlhttp.readyState==4) return xmlhttp.Status==200;
return false;
}
function mm(e, url)
{
if(!getURL(e.href)) e.href = url;
}
</script>
在body中添加:
<a href="http://www.smallrain.net/fuck.htm" onclick="mm(this, 'http://www.mrg.nease.net/')">test</a>
4.获取上一页和本页地址url的方法
上页地址document.referrer
本页地址document.URL