`
webcode
  • 浏览: 5957395 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

history.go

 
阅读更多
标签:

it

Javascript 返回上一页
1. Javascript 返回上一页 history.go(-1), 返回两个页面: history.go(-2);

2. history.back().

3. window.history.forward()返回下一页

4. window.history.go(返回第几页,也可以使用访问过的URL)

例:
<a href="javascript:history.go(-1);">向上一页</a>

response.Write("<script language=javascript>")
response.Write("if(!confirm('完成任务?')){history.back();}")
response.Write("</script>")
response.Write("<script language=javascript>history.go(-1);</script>")
<a href="javascript:history.go(-1);">向上一页</a>

页面跳转:onclick="window.location.href='list.aspx'"

P.S.
小技巧(JS引用JS):
<script type=text/javascript>
<!--
if (typeof SWFObject == "undefined") {
document.write('<scr' + 'ipt type="text/javascript" src="/scripts/swfobject-1.5.js"></scr' + 'ipt>');}
//-->
</script>

Javascript刷新页面的几种方法:
1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href

自动刷新页面的方法:
1.页面自动刷新:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.

2.页面自动跳转:把如下代码加入<head>区域中
<meta http-equiv="refresh" content="20;url=http://www.javaeye.com">
其中20指隔20秒后跳转到http://www.javaeye.com页面

3.页面自动刷新js版
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>

ASP.NET如何输出刷新父窗口脚本语句
1. this.response.write("<script>opener.location.reload();</script>");

2. this.response.write("<script>opener.window.location.href = opener.window.location.href;</script>");


3. Response.Write("<script language=javascript>opener.window.navigate(''你要刷新的页.asp'');</script>")


JS刷新框架的脚本语句

//如何刷新包含该框架的页面用
<script language=JavaScript>
parent.location.reload();
</script>

//子窗口刷新父窗口
<script language=JavaScript>
self.opener.location.reload();
</script>
( 或 <a href="javascript:opener.location.reload()">刷新</a> )

//如何刷新另一个框架的页面用
<script language=JavaScript>
parent.另一FrameID.location.reload();
</script>

如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下语句即可。

<body onload="opener.location.reload()"> 开窗时刷新
<body onUnload="opener.location.reload()"> 关闭时刷新

<script language="javascript">
window.opener.document.location.reload()
</script>

分享到:
评论

相关推荐

    javascript-history.go()和History.back()的区分_.docx

    javascript-history.go()和History.back()的区分_.docx

    js判断当页面无法回退时关闭网页否则就history.go(-1)

    在做一个Web项目时遇到一个需求,当页面没有前驱历史记录时(就是当前为新弹出的页面,没法做goback操作即history.go(-1)),点击返回按钮时直接关闭页面,否则就退回到前一页。 遇到的问题就是如何判断 是否有...

    [removed]history.go()和History.back()的区别及应用

    input type=button value=前进 onclick=”window.history.go(1)”&gt; &lt;input type=button value=后退 onclick=”window.history.go(-1)”&gt; &lt;input type=button value=前进 onclick=”window.history....

    浏览器执行history.go(-1) FCKeditor编辑框内显示html源代码的解决方法

    使用FCKeditor编辑文章,出于某种原因提交失败,此时浏览器执行返回动作,FckEditor编辑框内显示html代码。

    js实现上一页下一页的效果【附代码】

    1. history.go(-1), 返回两个页面: history.go(-2); 2. history.back(). 3. window.history.forward()返回下一页 4. window.history.go(返回第几页,也可以使用访问过的URL) 例: 复制代码 代码如下: 向上一页 ...

    由返回上一页并刷新页面想到的

    返回上一页并刷新返回上一页,我们经常用history.go(-1)//返回上一页(括号中写-2代表返回上两页) history.back()//返回上一页这个我很久之前的一篇文章中也提及了!但是有时候有这样的 ...       返回上一页并...

    HTML5无刷新改变当前url的代码

    //前进window.history.go(-1);//移动到指定记录点,当前倒退1,相当于window.history.forward()window.history.length//可以了解历史中有多少个记录点 以上只是查资料时候的附带 下面来说 history.pushState与...

    73种网页常用Javascript代码

    1、后退 前进 后退" onClick="history.go(-1)"&gt; 前进" onClick="history.go( 1 );return true;"&gt; 2、返回 &lt;form&gt;&lt;input type="button" value="返回上一步" onClick="history.back(-1)"&gt;&lt;/form&gt; 3、查看源码 查看源码...

    基于Jquery.history解决ajax的前进后退问题

    本文主要给大家介绍基于Jquery.history解决ajax的前进后退问题,涉及到jquery前进后退相关方面的知识,本文内容经典,非常具有参考价值,特此把jquery前进后退相关知识分享在脚本之家网站供大家参考

    php 简单注册登录实现

    history.go(-1);&lt;/script&gt;"; } else { if($psw == $psw_confirm) { mysql_connect("localhost","root",""); //连接数据库 mysql_select_db("vt"); //选择数据库 mysql_query("set names '...

    返回上一页面并刷新

    window.history.go(-1); 只能是回返目的,而未能刷新;使用self.location=document.referrer,如果原页面是post提交的多条件查询,也就显然无效。 写一个js基本解决这个问题了,欢迎大家指正。有需要同学也可以参考...

    iOS微信浏览器回退不刷新实例(监听浏览器回退事件)

    iOS在微信浏览器回退是不重新加载页面的,有些时候是需要重新加载的,所以需要监听回退事件 $(function(){ ... //window.history.go(-1); //你可以使用go()方法从当前会话的历史记录中加载页面(当

    网上商城毕业设计asp 文档

    history.go(-1);&lt;/script&gt;" conn.Close set conn=nothing response.end end if if not isnumeric(request.form("passcode")) then response.Write "&lt;script LANGUAGE='javascript'&gt;alert('登录失败!验证码...

    js 刷新页面的代码小结 推荐

    1. Javascript 返回上一页 history.go(-1), 返回两个页面: history.go(-2); 2. history.back(). 3. window.history.forward()返回下一页 4. window.history.go(返回第几页,也可以使用访问过的URL) 例: 向上一页&lt;/a&gt; ...

    js 返回上一页和刷新 的代码

    1. Javascript 返回上一页history.go(-1), 返回两个页面: history.go(-2);2. history.back().3. window.history.forward()返回下一页4. window.history.go(返回第几页,也可以使用访问过的URL) 例:向上一页&lt;/a&gt;...

    在线考试系统设计与实现

    location='javascript:history.go(-1)'&lt;/script&gt;"); }   (5)单击“忘码”按钮,进入忘码页面。 //找回密码 protected void btnPwd_Click(object sender, EventArgs e) { //Page.Response.Redirect("InfoPwd....

    perlgolf_history_070109.pdf

    Perlgolf History Perlgolf History Edition 2007-01-09 top secret / strictly confidential page 2 of 520 Contents 1. Intro.........................................................................

    JavaScript常用的返回,自动跳转,刷新,关闭语句汇总

    1. Javascript 返回上一页: 代码如下:history.go(-1)返回两个页面: 代码如下:history.go(-2)    2. 后退: 代码如下:history.back() 3. 返回下一页: 代码如下:window.history.forward() 4. 返回第几页,也可以...

Global site tag (gtag.js) - Google Analytics