Web Analytics Made Easy -
StatCounter And now for a propper question.... - CodingForum

Announcement

Collapse
No announcement yet.

And now for a propper question....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • And now for a propper question....

    I'm making a script that moves windows around like the boxes on the Minority Report site. I've got another script that does one window, and i'm modding it to work like those boxes. Only when i start it off, the box just wanders off down the screen untill it disappears and is never heard from again.

    This is the page:

    <html>
    <head>
    <script>
    function xopen(wins,speed,config,spacing){
    if (config == ""){
    document.status="!You have not set a config number!";
    }
    if (config == "1"){
    var left=(window.screen.availWidth / 2)-(99/2);
    var top=(window.screen.availHeight / 2)-(99/2);
    if (wins >= 1){
    var winone = window.open("","","left="+left+", top="+top+", width=99, height=99, scrollbars=no, status=no, resizable=no");
    }
    if (wins >= 2){
    var wintwo = window.open("","","left="+left+", top="+top+", width=99, height=99, scrollbars=no, status=no, resizable=no");
    }
    if (wins >= 3){
    var winthr = window.open("","","left="+left+", top="+top+", width=99, height=99, scrollbars=no, status=no, resizable=no");
    }
    if (wins > 3){
    document.status="!Only 3 windows allowed!";
    }
    winone.focus();
    var widthspeed=speed
    var heightspeed=speed/1.333333
    if (wins >= 3){
    var onego = 99+spacing
    var twogo = 99
    var thrgo = 99+spacing
    }
    if (wins == 2){
    var onego = 99+(spacing/2)
    var twogo = 99-(spacing/2)
    }
    if (wins == 1){
    var onego = 99
    }
    var goiup = 0
    for (goiup; goiup <= onego; goiup += heightspeed)
    {
    winone.moveTo((window.screen.availWidth/2)-(99/2), ((window.screen.availHeight/2)+goiup))
    goiup += heightspeed
    }
    }
    }
    </script>
    </head>
    <body>
    <input type="button" onClick="xopen('3','1','1','50')">
    </body>
    </html>



    PLEASSE HELP.
    I'm going insane with this thing... (*Thinks*)
    *More insane.

    Ta
    D2K2
    _______________

    Will code for food
    _______________

  • #2
    most of what i did here, is reorganize your code, but i did make a few changes here and there, too. it seems to be working fine.

    Code:
    <html>
    <head>
    <script>
    function xopen(wins,speed,config,spacing) {
        if (config == "") {
            alert("،You have not set a config number!");
            return;
            }
        if (wins > 3) {
            alert("!Only 3 windows allowed!");
            return;
            }
    
        if (config == "1") {
            var left = (window.screen.availWidth / 2) - (99/2);
            var top = (window.screen.availHeight / 2) - (99/2);
            var winds = [];
            for ( var i = 0; i < wins; i++) {
                winds[i] = window.open("","","left="+left+", top="+top+", width=99, height=99, scrollbars=no, status=no, resizable=no");
                }
            winds[1].focus();
            var widthspeed = speed;
            var heightspeed = speed/1.333333;
            var onego, twogo, thrgo;
    
            switch(wins) {
                case 3:
                 onego = 99 + spacing;
                 twogo = 99;
                 thrgo = 99 + spacing;
                 break;
                case 2:
                 onego = 99 + (spacing/2);
                 twogo = 99 - (spacing/2);
                 break;
                case 1:
                 onego = 99;
                 break;
                }
            for ( var goiup = 0; goiup <= onego; goiup += heightspeed) {
                winds[1].moveTo((window.screen.availWidth/2)-(99/2), ((window.screen.availHeight/2)+goiup));
                }
            }
        }
    </script>
    </head>
    <body>
    <input type="button" onClick="xopen(3,1,1,50);">
    </body>
    </html>
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

    Comment


    • #3
      Thanks joh6nn
      _______________

      Will code for food
      _______________

      Comment

      Working...
      X