Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <h1>localStorage window broadcast example</h1>
- <script>
- function openwindows(n){
- var h = window.screen.height / n,
- w = window.screen.width / n, i, j;
- for (i = 0; i < n; i += 1) {
- for (j = 0; j < n; j += 1) {
- window.open('window.html', '_blank', "width=" + (w - 10) + ",height=" + (h - 60) + ",resizable=no,scrollbars=no,status=no,left=" + (i * w) + ",top=" + (j * h));
- }
- }
- }
- function openwindow(){
- var h = window.screen.height,
- w = window.screen.width;
- window.open('window.html', '_blank', "width=200,height=200,resizable=no,scrollbars=no,status=no,left=" + (~~(Math.random()*w)) + ",top=" + (~~(Math.random()*h)));
- }
- </script>
- <button onclick="openwindow();">Open 1 window</button>
- <button onclick="openwindows(4);">Open 16 windows</button>
- <button onclick="openwindows(5);">Open 25 windows</button>
- </body>
Add Comment
Please, Sign In to add comment