...

View Full Version : random numbers



gencoglu4
11-07-2004, 06:06 PM
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>

Garadon
11-07-2004, 09:15 PM
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;

}}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum