常用JS方法

有些js方法,我们经常用,却也经常忘记,所以我就写下来

1,关闭子窗口,给父窗口返回一个值 window.returnValue = "";
2,在子窗口中得到父窗口传过来的参数  var result = window.dialogArguments;
3,弹出一个模态窗口 window.showModalDialog(url,agruments,sFeatures),非模态用showModelessDialog,参数相同。url为要转到的页面,agruments是参数(随便什么都行),sFeatures是窗口大小一类的东西,具体有:
(1)dialogHeight:   对话框高度,不小于100px
(2) dialogWidth:   对话框宽度。
(3) dialogLeft:    离屏幕左的距离。
(4)dialogTop:    离屏幕上的距离。
(5)center:         { yes | no | 1 | 0 } :             是否居中,默认yes,但仍可以指定高度和宽度。
(6)help:            {yes | no | 1 | 0 }:               是否显示帮助按钮,默认yes。
(7)resizable:      {yes | no | 1 | 0 } [IE5+]:    是否可被改变大小。默认no。
(8)status:         {yes | no | 1 | 0 } [IE5+]:     是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
(9)scroll:           { yes | no | 1 | 0 | on | off }:是否显示滚动条。默认为yes。

4,onload在后台的Page_Load执行后才开始执行
5,str.substring(start,end),截取字符串,如果只有start,则直接截取到结尾。
6,str.indexOf("a"),判断a在字符串中最先出现的位置,如果没有则为-1。这个方法大多被用来判断字符串中是否包含该子串。
7,location.href:js中的转向其它页面的属性。
8,除法取整  var a= 9/2|0;
posted @ 2008-05-21 12:24  GodSpeed  阅读(865)  评论(1编辑  收藏  举报