Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: random numbers

  1. #1
    New Coder
    Join Date
    Oct 2004
    Posts
    37
    Thanks
    0
    Thanked 1 Time in 1 Post

    Arrow random numbers

    hi,
    The problem with the following script is that I always get the same numbers..I mean the last two numbers are the same!!!
    secondly How can I jump the second column (the green div) after the 10th.line
    thanks

    <html>
    <head>
    <style>
    #list{position:absolute;top:50;left:20;color:blue;background-colorink;}
    #list2{position:absolute;top:50;left:160;color:blue;background-color:yellow;}
    #list3{position:absolute;top:50;left:330;color:white;background-color:green;}
    #cont{position:absolute;top:5;left:220;height:1;width:20; color:white;background-color:black;}
    </style>
    <script>
    var con;
    var cona;
    con=1;
    cona=0;
    function startB()
    {
    document.getElementById('cont').innerHTML= "<h2>"+ con +"</h2>";
    bbb=Math.round(Math.random()*49)+1;
    con++;
    document.getElementById('list').innerHTML+=bbb+"-";

    if(cona==10)
    {
    alert("the next layer")
    document.getElementById('list3').innerHTML+=bbb+"-";
    document.getElementById('list3').innerHTML+=bbb+"-"+"<br><hr width=140>";
    }

    if(con==6)
    {
    cona==1
    cona++;
    document.getElementById('list').innerHTML+=bbb+"-"+"<br><hr width=140>";
    document.getElementById('list2').innerHTML+="<font color=red><b>"+cona+"..line</b></font><br><hr width=30>";
    con=1;

    }}
    </script>
    </head>
    <body>
    <div id=list></div>
    <div id=list2></div>
    <div id=list3></div>
    <div id=cont>....</div>
    <form>
    <input type="button" value="printTheNums" onClick="startB()"><br>
    </form>
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    didn't get the jump comment:

    var con;
    var cona;
    con=1;
    cona=0;
    function startB()
    {
    document.getElementById('cont').innerHTML= "<h2>"+ con +"</h2>";
    bbb=Math.round(Math.random()*49)+1;
    con++;
    document.getElementById('list').innerHTML+=bbb+"-";

    if(cona==10)
    {
    alert("the next layer")
    document.getElementById('list3').innerHTML+=bbb+"-";
    document.getElementById('list3').innerHTML+=bbb+"-"+"<br><hr width=140>";
    }

    if(con==7)
    {
    cona==1
    cona++;
    document.getElementById('list').innerHTML+="<br><hr width=140>";
    document.getElementById('list2').innerHTML+="<font color=red><b>"+cona+"..line</b></font><br><hr width=30>";
    con=1;

    }}


  •  

    Posting Permissions

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