javascript革新页面代码大全
发布时间:2018-08-18 08:43:07 所属栏目:创业 来源:站长网
导读:js的成果太强盛了,就是没有一个好点的编码器材,传闻.net2008已经有语法提醒了,,然则我还没有效,,过几天在说吧!照旧办理题目!找了找,找到了零零散星的片断代码,此刻我在这里清算一下,以利便往后用! 有三个页面别离定名为frame.html、top.html、bo
js的成果太强盛了,就是没有一个好点的编码器材,传闻.net2008已经有语法提醒了,,然则我还没有效,,过几天在说吧!照旧办理题目!找了找,找到了零零散星的片断代码,此刻我在这里清算一下,以利便往后用! 有三个页面别离定名为frame.html、top.html、bottom.html frame.html 由上(top.html)下(bottom.html)两个页面构成,代码如下: <frameset rows="50%,50%"> <frame name=top src="top.html"> <frame name=bottom src="bottom.html"> </frameset> 此刻假设top.html (即上面的页面) 有七个button来实现对bottom.html (即下面的页面) 的革新,可以用以下七种语句,哪个好用本身看着办了。 语句1. window.parent.frames[1].location.reload(); 语句2. window.parent.frames.bottom.location.reload(); 语句3. window.parent.frames["bottom"].location.reload(); 语句4. window.parent.frames.item(1).location.reload(); 语句5. window.parent.frames.item(''bottom'').location.reload(); 语句6. window.parent.bottom.location.reload(); 语句7. window.parent[''bottom''].location.reload(); top.html 页面的代码如下: <HTML> <HEAD> <TITLE> top.html </TITLE> </HEAD> <BODY> <input type=button value="革新1" onclick="window.parent.frames[1].location.reload()"><br> <input type=button value="革新2" onclick="window.parent.frames.bottom.location.reload()"><br> <input type=button value="革新3" onclick="window.parent.frames[''bottom''].location.reload()"><br> <input type=button value="革新4" onclick="window.parent.frames.item(1).location.reload()"><br> <input type=button value="革新5" onclick="window.parent.frames.item(''bottom'').location.reload()"><br> <input type=button value="革新6" onclick="window.parent.bottom.location.reload()"> ;<br> <input type=button value="革新7" onclick="window.parent[''bottom''].location.reload()"><br> </BODY> </HTML> 下面是bottom.html页面源代码,为了证明下方页面简直被革新了,在装载完页面弹出一个对话框。 bottom.html 页面的代码如下: <HTML> <HEAD> <TITLE> bottom.html </TITLE> </HEAD> <BODY onload="alert(''我被加载了!'')"> <h1>This is the content in bottom.html.</h1> </BODY> </HTML> 表明一下: 1.window指代的是当前页面,譬喻对付此例它指的是top.html页面。 2.parent指的是当前页面的父页面,也就是包括它的框架页面。譬喻对付此例它指的是framedemo.html。 3.frames是window工具,是一个数组。代表着该框架内全部子页面。 4.item是要领。返回数组内里的元素。 5.假如子页面也是个框架页面,内里照旧其余的子页面,那么上面的有些要领也许不可。 附: 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.veryhuo.com"> 个中20指隔20秒后跳转到http://www.veryhuo.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() 或许也就找到这么多,我不行能一下子全记着,往后要用到的时辰在来查就好了 (编辑:河北网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |