|
用showModalDialog来打开页面 |
|
在网上大部分用的都是window.open来打开窗口,但你知不知道还有另一种方法?试试用showModalDialog函数,在本个例子一共用到三个文件,文件的内容如下:[想看看效果请点这里]
First HTML(test.html) : <html> <head> <title>Welcome!</title> </head> <body> <a onclick=ppup1()>点这里</a> </body> <script language='javascript'> function ppup1(){ y=window.showModalDialog("testpp1.html","Dialog Arguments Value","dialogHeight: 100px; dialogWidth: 400px; dialogTop: 400px; dialogLeft: 300px; center: no; help: no"); } </script> </html> Second HTML(testpp1.html) : <html> <head> <title>Pop Up1</title> </head> <body> <a onclick=ppup2() >看见我了吗?试试再点我一下!</a> <script language='jscript'> function ppup2(){ y=window.showModalDialog("testpp2.html","Dialog Arguments Value","dialogHeight: 100px; dialogWidth: 400px; dialogTop: 200px; dialogLeft: 300px; center: no; help: no"); } </script> </body> </html> Third HTML(testpp2.html): <html> <head> <title>Popup2</title> </head> <body onunload=window.returnValue="Returning"> I am in the second popup </body> </html> 相信showModalDialog这个函数的参数你一定看得懂,这里我就不再解析了。:) |