易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript:history.go()和History.back()的区别收藏

<input   type=button   value=刷新   onclick="window.location.reload()">  
  <input   type=button   value=前进   onclick="window.history.go(1)">  
  <input   type=button   value=后退   onclick="window.history.go(-1)">  
  <input   type=button   value=前进   onclick="window.history.forward()">  
  <input   type=button   value=后退   onclick="window.history.back()">
 
后退+刷新
<input   type=button   value=后退   onclick="window.history.go(-1);window.location.reload()">
在C# Web程序中,如为页面按钮写返回上一页代码
this.RegisterClientScriptBlock("E", "<script language=javascript>history.go(-2);</script>");
其中,history.go(-2),要写为-2,因在按钮事件触发前,已刷新一次页面,所以应是-2。
Response.Write("<script language=javascript>history.go(-2);</script>");
此处也要写为“-2”。跟直接写脚本的有所不同。
 
history.back()是会上一页
i=1
history.go(i)去指定的某页
如果是history.go(0)那就是刷新
 
 
 
这两个属于JS代码,相当于IE的前进、后退功能。
具体的用处就要看什么时候需要这个就用上。比如用户注册时的验证是后台验证,不符合要求的时候就可以用这个,可以最大限度保证用户少重复输入数据。
例如:载入页面:
  function onLoadPage(){
    if(event.srcElement.tagName=="SPAN"){
        oFrame=top.window.middle.frames[2];
        oTxt=event.srcElement.innerText;
        switch(oTxt){
            case "前 进":
                oFrame.history.go(1);
            case "后 退":
    &n


相关文档:

javascript中获取一个字符串中 特定字符串的个数

//统计字符串中特定字符串的个数
function getStrCount(scrstr,armstr)
{ //scrstr 源字符串 armstr 特殊字符
 var count=0;
 while(scrstr.indexOf(armstr) >=1 )
 {
    scrstr = scrstr.replace(armstr,"")
    count++;   
 }
 re ......

Javascript的history对象

history对象3个方法back()、forward()和go(),这些方法可以调用历史表中包含的文档。
back()方法装入历史表中的前一个页面,等效于浏览器中的Back按钮
forward()方法装入历史表中的后一个页面,等效于浏览器中的Forward按钮
go()方法进入历史表中的特定文档,可以取整形参数或字符串参数
go(n)n>0时,装入历史表中的 ......

IE和FireFox的兼容的javascript回车事件

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" %>
<!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 runat="serve ......

Javascript[转]


<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......

a href="javascript:if(confirm(


a href="javascript:if(confirm(
悬赏分:0 - 解决时间:2008-9-25 13:58
a href="javascript:if(confirm('http://hunter.51rc.com/ \n\n文件并未依 Teleport Pro 取回,因为 它的域或路径超过开始网址中设置的范围。 \n\n你要从服务器上打开它吗?'))window.location='http://hunter.51rc.com/'" tppabs="http://h ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号