random stuff

egeer

by mrcrazypants987

HTML

<body>


<input type="text" onkeypress="blagh()">

<script>

function blagh(){
 alert("woooooo");
}

</script>
<button class="btn1">left</button>
<button class="btn2">right</button>
<p1 style="height:100px;width:200px;position:absolute;right:0">HELLO</p1>
<p2 style="height:100px;width:200px;position:absolute;right:0;">HELLO</p2>
<p3 style="height:100px;width:200px;position:absolute;right:0">HELLO</p3>
<p4 style="height:100px;width:200px;position:absolute;right:0;">HELLO</p4>
<p5 style="height:100px;width:200px;position:absolute;right:0">HELLO</p5>
<p6 style="height:100px;width:200px;position:absolute;right:0;">HELLO</p6>
<p7 style="height:100px;width:200px;position:absolute;right:0">HELLO</p7>
<p8 style="height:100px;width:200px;position:absolute;right:0;">HELLO</p8>


<button class="btn3">???</button>
</body>

CSS

p{
  position:absolute
}

JavaScript

$(document).ready(function(){
    $(".btn1").click(function(){
        $("p1").animate({right: "+=300px"});
    });
    //moves left
    $(".btn2").click(function(){
        $("p1").animate({right: "-=300px"});
    });
    // moves right
});
  $(".btn3").click(function(){
        $("p1").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    });
      $(".btn3").click(function(){
        $("p2").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    });
       $(".btn3").click(function(){
        $("p3").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    });
       $(".btn3").click(function(){
        $("p4").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    }); $(".btn3").click(function(){
        $("p5").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    });
      $(".btn3").click(function(){
        $("p6").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    });
       $(".btn3").click(function(){
        $("p7").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    });
       $(".btn3").click(function(){
        $("p8").animate({right: (Math.random()*500)+"px",
        top:(Math.random()*500)+"px",

        });

    });