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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

posted on 2006-12-16 22:54 常言笑 閱讀(312) 評論(0) 編輯 收藏 所屬分類: JAVASCRIPT/AJAX