I have this html:
<html>
<head>
<meta charset="UTF-8">
<title>Bonoloto</title>
<script src="bonoloto.js"></script>
<style>
table {border-collapse: collapse;}
td{border: 1px solid #000; text-align: center; width: 6%;}
</style>
</head>
<body>
<script>
randomNumbers();
tables();
</script>
</body>
</html>
And the next Javascript:
randomNumbers1 = new Array();
randomNumbers2 = new Array();
commonNumbers = new Array();
function randomNumbers() {
document.write("First line:");
for (i = 0; i< 6; i++) {
randomNumbers1[i]=Math.floor(Math.random() * 49 + 1);
document.write(randomNumbers1[i] + " ");
}
document.write("<br/>");
document.write("Second line:");
for (i = 0; i< 6; i++) {
randomNumbers2[i]=Math.floor(Math.random() * 49 + 1);
document.write(randomNumbers2[i] + " ");
}
}
function tables(){
document.write("<table>");
var counter = 0;
for(i = 1; i < 50; i++) {
counter++;
if(counter == 11) {
counter = 0;
document.write("<tr>");
}
document.write("<td>" + i + "</td>");
if(counter == 10) {
counter = 0;
document.write("</tr>");
}
}
document.write("</table>");
}
How can i do to:
- not allow same random numbers to be in the array more than 1 time.
- the first line of numbers mark them in the table with yellow and the second line of numbers mark them with blue.
- if the first numbers and the second numbers are the same (random numbers) mark them in the table with green.