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

Javascript 刷新框架及页面的方法总集

 先来看一个简单的例子:
下面以三个页面分别命名为frame.html、top.html、bottom.html为例来具体说明如何做。
frame.html 由上(top.html)下(bottom.html)两个页面组成,代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> frame </TITLE>
</HEAD>
<frameset rows="50%,50%">
<frame name=top src="top.html">
<frame name=bottom src="bottom.html">
</frameset>
</HTML>
现在假设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 页面的代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<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页面源代


相关文档:

鼠标有关JavaScript事件

 <script>
var times = 0;
var ms = new Date();
var prex =0;
var pretoright=false;
var level =0;
function trackEarthQuake(){
     var curx = event.screenX;
     var toright ;
     if(curx>prex){
     ......

javascript

 第一题
编写一个方法 求一个字符串的字节长度
第二题
如何控制alert中的换行
第三题
解释document.getElementById("ElementID").style.fontSize="1.5em"
第四题
将一个类似图中的效果分离成css和html
第五题
按照格式 xxxx年xx月xx日xx时xx分xx秒动态显示时间 要求不足10的补0
第六题
编写一个方法 去掉一 ......

JavaScript去掉两端空格方法

  // 去掉字符串左边空格
   function trimToLeft(str){
        var i;
        for(i=0;i<str.length; i++) {
            if(str.charAt(i)!=" ") break;
......

javascript 获取css 属性

 我们有时获取 styl.width为空的时候,可以获取css中的width..
但ie and ff 是不同的。。
ie:
obj.currentStyle['width'] 
ff:
var css = document.defaultView.getComputedStyle(obj, null);  
css.getPropertyValue('width')  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号