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

Javascript刷新页面大全

非模态刷新父页面:window.opener.location.reload();
模态刷新父页面:window.dialogArguments.location.reload();
 
先来看一个简单的例子:
   下面以三个页面分别命名为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&


相关文档:

公历转换农历的算法(JavaScript)

很经典的一个算法,学习…ing… :
<!--  中国农历开始  -->
<SCRIPT language=JavaScript>
<!--
var lunarInfo=new Array(
0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,
0x04ae0,0x0a5b6,0x0a4d0,0x0d25 ......

增加 javascript 的 trim 函数


去除字符串左右两端的空格,在vbscript里面可以轻松地使用 trim、ltrim 或 rtrim,但在js中却没有这3个内置方法,需要手工编写。下面的实现方法是用到了正则表达式,效率不错,并把这三个方法加入String对象的内置方法中去。
<input type="text" name="mytxt" value="   12345678 &nbs ......

javascript:void(0)

今天看到《AJAX开发简略》中所有的<A href>都用到了javascript:void(0)
今天看了一下原来这个表达式的作用就是让当前这个超链接成为一个死链接,就是什么都不作。
以下摘自:
http://blog.csdn.net/mouyong/archive/2007/01/24/1491761.aspx
别人些的JavaScript脚本可以看到这样的代码:
<a href="javascript ......

javascript 浮动窗口滚动.拖动

<script type="text/javascript">
 function close(){
  QQkefu.style.display="none";
  return true;
 }
  function msgBox()
 {
  this.container = "aaaa";
  this.titleheadArea = "titlehead";
  this.width = 154; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号