<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> body{ /*margin: 0;*/ } #div1{ width: 100px; height: 100px; border: 1px solid red; } </style> </head> <body> <div> </div> <button>获取div信息</button> <hr/> <a href="https://www.jb51.net/111.html" target="_blank">我是超链接</a> <br/><br/> <button>新窗口111111111</button> <button>新窗口222222222</button> <button>新窗口333333333</button> <hr/> <button>关掉子窗口</button> <script> var mywin; function myclose(){ if(mywin) mywin.close(); } function myopen3(){ mywin = window.open('333.html', 'news', 'resizable=no'); } function myopen2(){ mywin = window.open('222.html', 'news', 'resizable=no'); } function myopen1(){ mywin = window.open('https://www.jb51.net/111.html', 'news', 'resizable=no'); } function getInfo(obj){ // var div1 = document.getElementById('div1'); obj.innerHTML = obj.offsetWidth+',,'+obj.offsetHeight; obj.innerHTML += '<br>'+obj.offsetLeft+',,'+obj.offsetTop; // offsetXXX 只能读取不能赋值修改 obj.offsetWidth = obj.offsetWidth+100; // 下面的属性已经不能用了 // obj.innerHTML += '<br>'+obj.innerWidth+',,'+obj.innerHeight; } </script> </body> </html>
js弹出窗口简单实现代码
内容版权声明:除非注明,否则皆为本站原创文章。