1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < title > BOM相关操作</ title >
5
+ < meta charset ="utf-8 ">
6
+ < script type ="text/javascript ">
7
+ function clickButton ( ) {
8
+ var wroxWin = window . open ( "http://www.baidu.com" , "name" , "height=400,width=400,top=10,left=10,resizable=yes" ) ;
9
+
10
+ }
11
+ function clickButton2 ( ) {
12
+ //location.href = "https://mail.qq.com/cgi-bin/frame_html?sid=A9Qm4HxhCnZad2A4&r=9fb55a1813ce7b55e711e0519b73f2ff";
13
+ var argus = getQueryStringArgs ( ) ;
14
+ console . log ( argus ) ;
15
+ }
16
+ function clickButton3 ( ) {
17
+ alert ( hasPlugin ( "Flash" ) ) ;
18
+ }
19
+ function getQueryStringArgs ( ) {
20
+ var qs = ( location . search . length > 0 ? location . search . substring ( 1 ) : "" ) ;
21
+ var argus = { } ;
22
+ var items = qs . length ? qs . split ( "&" ) :[ ] ;
23
+ var item = null , name = null , value = null , i = 0 , len = items . length ;
24
+ for ( var i = 0 ; i < len ; i ++ ) {
25
+ item = items [ i ] . split ( "=" ) ;
26
+ name = decodeURIComponent ( item [ 0 ] ) ;
27
+ value = decodeURIComponent ( item [ 1 ] ) ;
28
+ if ( name . length ) {
29
+ argus [ name ] = value ;
30
+ }
31
+ }
32
+ return argus ;
33
+ }
34
+ function hasPlugin ( name ) {
35
+ name = name . toLowerCase ( ) ;
36
+ for ( var i = 0 ; i < navigator . plugins . length ; i ++ ) {
37
+ if ( navigator . plugins [ i ] . name . toLowerCase ( ) . indexOf ( name ) > - 1 ) {
38
+ return true ;
39
+ }
40
+ }
41
+ return false ;
42
+ }
43
+ </ script >
44
+ < style type ="text/css ">
45
+ </ style >
46
+ </ head >
47
+ < body >
48
+ < button type ="button " onclick ="clickButton() " value ="其他页面 " > 其他页面</ button >
49
+ < button type ="button " onclick ="clickButton2() "> 获取location信息</ button >
50
+ < button type ="button " onclick ="clickButton3() "> 检测插件</ button >
51
+ </ body >
52
+ </ html >
0 commit comments