常言笑的家

Spring, Hibernate, Struts, Ajax, RoR

JavaScript小技巧

1、弹出窗口总是在最上面

[1] <body ="this.focus();">

[2]模态窗口showModalDialog(url); 不过模式窗口中对老页面无法回写,打开的子窗口不能得到openner,因此子窗口无法访问父窗口数据. 如果要传递数据的话, 只能在Dialog窗口中用return,然后父窗口通过var some = showModalDialog(...)得到值.

[3]非模态窗口window.showModelessDialog

[4]open来打开新窗口


2、输入框屏蔽输入法输入

[1]style="ime-mode:disabled"  <input>中加入
[2]onpaste="return false" 不能粘贴 <body>中
[3]oncopy="return false"  不能复制 <body>中
 
3、各种尺寸

 1 <  LANGUAGE ="Java" >
 2
 3 var s = "网页可见区域宽:"+ document .body.clientWidth; 
 4 s += "\r\n网页可见区域高:"+ document .body.clientHeight; 
 5 s += "\r\n网页可见区域高:"+ document .body.offsetWeight +" (包括边线的宽)"; 
 6 s += "\r\n网页可见区域高:"+ document .body.offsetHeight +" (包括边线的宽)"; 
 7 s += "\r\n网页正文全文宽:"+ document .body.scrollWidth; 
 8 s += "\r\n网页正文全文高:"+ document .body.scrollHeight; 
 9 s += "\r\n网页被卷去的高:"+ document .body.scrollTop; 
10 s += "\r\n网页被卷去的左:"+ document .body.scrollLeft; 
11 s += "\r\n网页正文部分上:"+ window .screenTop; 
12 s += "\r\n网页正文部分左:"+ window .screenLeft; 
13 s += "\r\n屏幕分辨率的高:"+ window .screen.height; 
14 s += "\r\n屏幕分辨率的宽:"+ window .screen.width; 
15 s += "\r\n屏幕可用工作区高度:"+ window .screen.availHeight; 
16 s += "\r\n屏幕可用工作区宽度:"+ window .screen.availWidth; 
17 alert(s); 
18
19 </>
20

posted on 2006-12-16 22:54 常言笑 阅读(298) 评论(0)  编辑  收藏 所属分类: JAVASCRIPT/AJAX


只有注册用户登录后才能发表评论。


网站导航:
 

My Links

Blog Stats

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜