javascript当中history的用法

6.history              (视频下载) (全部书籍)


例 1.6(firstIEFF.html)


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>

</HEAD>

<BODY>
<A HREF="second.html">进入second.html</A>
</BODY>
</HTML>




second.html




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<TITLE> New Document </TITLE>

<SCRIPT LANGUAGE="JavaScript">
<!--
/*Window.history (Property)
This property returns a history object for this window.

Property/method value type:    History object
JavaScript syntax:    -    history
-    myWindow.history

.*/
window.onload=function(){
    var num = Math.round(Math.random()*100);

    document.getElementById("num").innerHTML=num;
}
//-->
</SCRIPT>
</HEAD>

<BODY>
qixy: the function of history.go(x) is the same as the button of IE itself, so think about the function of the button of IE itself
<INPUT TYPE="button" value="后退" onclick="history.go(-1)">&nbsp;
<INPUT TYPE="button" value="前进"  onclick="history.go(1)">&nbsp;
<INPUT TYPE="button" value="刷新"  onclick="history.go(0)">
<p>刷新演示:<div id="num"></div></p>

详见原文地址:http://www.mark-to-win.com/index.html?content=Javascript/jsUrl.html&chapter=Javascript/js5_web.html#history

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/88664978
今日推荐