Results 1 to 2 of 2

Thread: snakes and ladders

  1. #1
    Join Date
    Apr 2007
    Posts
    0
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default snakes and ladders

    <html>
    <head>
    <title>snakes & ladders</title>
    </head>
    <head>

    <style type="text/css">
    .a1{
    position:relative;
    font-family:Verdana;
    font-size:20px;
    color:#888888;
    }
    </style>

    <script language="JavaScript">

    var totalnumbers=1 //input total numbers to generate
    var lowerbound=1 //input lower bound for each random number
    var upperbound=6 //input upper bound for each random number

    function lotto(){
    B=' ';
    LottoNumbers=new Array();
    for (i = 1; i <= totalnumbers; i++)
    {
    RandomNumber = Math.round(lowerbound+Math.random()*(upperbound-lowerbound));
    for (j = 1; j <= totalnumbers; j)
    {
    if (RandomNumber == LottoNumbers[j])
    {
    RandomNumber=Math.round(lowerbound+Math.random()*(upperbound-lowerbound));
    j=0;
    }
    j++;
    }
    LottoNumbers[i]=RandomNumber;
    }
    LottoNumbers=LottoNumbers.toString();
    X=LottoNumbers.split(',');
    for (i=0; i < X.length; i++)
    {
    X[i]=X[i]+' ';
    if (X[i].length==2)
    X[i]='0'+X[i];
    }
    X=X.sort();
    for (i=0; i < X.length; i++)
    {
    OutPut=B+=X[i];
    }
    if (document.all)document.all.layer1.innerHTML=OutPut;
    if (document.getElementById)document.getElementById("layer1").innerHTML=OutPut;
    if (document.layers){
    document.layers.layer1.document.open();
    document.layers.layer1.document.write("<span style='position:absolute;top:0px;left:0px;font-family:Verdana;font-size:20px;color:#888888;text-align:center'> "+OutPut+"</span>");
    document.layers.layer1.document.close();
    }
    T=setTimeout('lotto()',20);
    //window.status=OutPut;
    }
    function StOp(){
    setTimeout('clearTimeout(T)',1000);
    }
    //-->
    </script>

    <style type="text/css">

    .drag{
    position:relative;
    cursor:hand;
    z-index: 100;
    }

    </style>

    <script type="text/javascript">


    var dragobject={
    z: 0, x: 0, y: 0, offsetx : null, offsety : null, targetobj : null, dragapproved : 0,
    initialize:function(){
    document.onmousedown=this.drag
    document.onmouseup=function(){this.dragapproved=0}
    },
    drag:function(e){
    var evtobj=window.event? window.event : e
    this.targetobj=window.event? event.srcElement : e.target
    if (this.targetobj.className=="drag"){
    this.dragapproved=1
    if (isNaN(parseInt(this.targetobj.style.left))){this.targetobj.style.left=0}
    if (isNaN(parseInt(this.targetobj.style.top))){this.targetobj.style.top=0}
    this.offsetx=parseInt(this.targetobj.style.left)
    this.offsety=parseInt(this.targetobj.style.top)
    this.x=evtobj.clientX
    this.y=evtobj.clientY
    if (evtobj.preventDefault)
    evtobj.preventDefault()
    document.onmousemove=dragobject.moveit
    }
    },
    moveit:function(e){
    var evtobj=window.event? window.event : e
    if (this.dragapproved==1){
    this.targetobj.style.left=this.offsetx+evtobj.clientX-this.x+"px"
    this.targetobj.style.top=this.offsety+evtobj.clientY-this.y+"px"
    return false
    }
    }
    }

    dragobject.initialize()

    </script>
    </head>


    <body bgcolor="orrange">

    <center>
    <img src="http://www.alasdairgeddes.com/images/snakes and ladders logo.bmp "><br>
    </center>

    <center><IMG SRC="http://www.alasdairgeddes.com/images/snakes and ladders.gif " HEIGHT=700WIDTH=700ALT="snakes and ladders"></center>

    <p>
    how to play </p>
    <p>
    1) Both players chose a piece and move it to the 'start' square.
    </p>
    <p>
    2) Click on the random number generator button at the bottom of the page. The number on the random number generator is the amount of squares the player moves. Take turns clicking on the random number generator and moving your pieces. The first player to reach the 'finish' square is the winner. If you land at the head of a snake, then you move to the tail of the snake. If you land at the bottom of a ladder, then you go to the top of the ladder. If you land on a square that has a cartoon character on it, then you have to go around the room acting out that character in the most funny way possible.
    </p>
    <center>
    <img src="http://www.alasdairgeddes.com/images/car 1.gif" class="drag"><br>
    </center>
    <center>
    <img src="http://www.alasdairgeddes.com/images/car 2.gif" class="drag"><br>
    </center>
    <center>
    <img src="http://www.alasdairgeddes.com/.smileys/smiley1.gif" class="drag"" HEIGHT=50WIDTH=50ALT="snakes and ladders"><br></center>
    <center>
    <img src="http://www.alasdairgeddes.com/.smileys/smiley4.gif" class="drag"" HEIGHT=50WIDTH=50ALT="snakes and ladders"><br></center>

    <table border='0' width=250 height=50>
    <tr valign='middle'>
    <td align='center'>
    <form name=form>
    <input type=button value='random number genorator' onClick="lotto();StOp()">
    </form>
    <span id=layer1 class=a1>Result</span>
    </td>
    </tr>
    </table>

    <SCRIPT TYPE="text/javascript">
    <!--
    var filename="http://www.alasdairgeddes.com/music/01 Spiel Mit Mir.mp3";
    if (navigator.appName == "Microsoft Internet Explorer+mozilla firefox")
    document.writeln ('<BGSOUND SRC="' + filename + '">');
    else if (navigator.appName == "Netscape")
    document.writeln ('<EMBED SRC="' + filename + '" AUTOSTART=TRUE WIDTH=144 HEIGHT=60><P>');
    // -->
    </SCRIPT>
    <NOSCRIPT>
    <BGSOUND SRC="http://www.alasdairgeddes.com/music/01 Spiel Mit Mir.mp3">
    </NOSCRIPT>

    </body>

    </html>

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Is there a question involved or are you just sharing this information? If the first, please post the question.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •