
1.超链接返回上一页代码:
<a href=”#” onClick=”javascript :history.back(-1)”>返回上一页</a>
<a href=”#” onClick=”javascript :history.go(-1)”>返回上一页</a>
2.用按钮代码:
<input type=”button” name=”Submit” onclick=”javascript:history.back(-1)” value=”返回上一页”>
3.图片代码:
<a href=”javascript :” onClick=”javascript :history.back(-1)”><img src=”图片路径” border=”0″ title=”返回上一页”></a>
[color=#FF0000]几秒钟后[/color]自动返回上一页代码:(加入两个head间,3000表示3秒)
<SCRIPT language=javascript>
function go()
{
window.history.go(-1)
}
setTimeout(“go()”,3000)
</SCRIPT>
“>返回上一页</a>
<script>alert(‘发布失败’)location.href=’index.php’window.history.go(-1)
</script>
扩展资料:
跳转页面的html代码的几种写法
html的实现
<head>
<!-- 以下方式只是刷新不跳转到其他页面 -->
<meta http-equiv="refresh" content="10">
<!-- 以下方式定时转到其他页面 -->
<meta http-equiv="refresh" content="5url=hello.html">
</head>
2. javascript的实现
<script language="javascript" type="text/javascript">
// 以下方式直接跳转
window.location.href='hello.html'
// 以下方式定时跳转
setTimeout("javascript:location.href='hello.html'", 5000)
</script>
3.结合了倒数的javascript实现(IE)
<span id="totalSecond">5</span>
<script language="javascript" type="text/javascript">
var second = totalSecond.innerText
setInterval("redirect()", 1000)
function redirect(){
totalSecond.innerText=--second
if(second<0) location.href='hello.html'
}
</script>
参考资料:百度百科-html代码
加一个meta标记或写一个js代码,把写好的代码保存为html文件就可以了。
点菜单栏->工具->internet选项(或选项) ->常规 在这里设置主页就可以选择自己要跳转的页面。
代码例如:
<!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/htmlcharset=gb2312" /><meta http-equiv="Content-Language" content="zh-CN">
<meta HTTP-EQUIV="Content-Type"CONTENT="text/htmlcharset=gb2312"><meta http-equiv="refresh"content="0.1url= http://www.cnvzz.cn">
</head>
<body>
</body>
</html>
参考资料
百度.百度[引用时间2018-1-5]
我是在使用iframe是遇到这个问题的,登录按钮引用的是另一个header.html的文件,点击退出登录后,发现只有这个引用header.html的iframe的页面刷新到登录界面,其他的部分还停留在原来的界面。
解决方法
在点击退出跳转的链接增加一个target属性,并设置值为"_top"。target="_top"
_top
这个目标使得文档载入包含这个超链接的窗口,用 _top 目标将会清除所有被包含的框架并将文档载入整个浏览器窗口。
例如:
最后验证是可以的。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)