Guest User

Untitled

a guest
Jul 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <body>
  2. <h1>localStorage window broadcast example</h1>
  3. <script>
  4.  
  5. function openwindows(n){
  6. var h = window.screen.height / n,
  7. w = window.screen.width / n, i, j;
  8.  
  9. for (i = 0; i < n; i += 1) {
  10. for (j = 0; j < n; j += 1) {
  11. window.open('window.html', '_blank', "width=" + (w - 10) + ",height=" + (h - 60) + ",resizable=no,scrollbars=no,status=no,left=" + (i * w) + ",top=" + (j * h));
  12. }
  13. }
  14. }
  15.  
  16. function openwindow(){
  17. var h = window.screen.height,
  18. w = window.screen.width;
  19.  
  20. window.open('window.html', '_blank', "width=200,height=200,resizable=no,scrollbars=no,status=no,left=" + (~~(Math.random()*w)) + ",top=" + (~~(Math.random()*h)));
  21. }
  22.  
  23. </script>
  24. <button onclick="openwindow();">Open 1 window</button>
  25. <button onclick="openwindows(4);">Open 16 windows</button>
  26. <button onclick="openwindows(5);">Open 25 windows</button>
  27. </body>
Add Comment
Please, Sign In to add comment