Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Howtoechothatjsto6divtag

window.onload = function(){
	lotto1();
};

function lotto1(){
	B='';
	LottoNumbers=new Array();
	for (i = 1; i <= 1; i++){
		RandomNumber = Math.round(0+Math.random()*(9999-0));
		for (j = 1; j <= 1; j){
			if (RandomNumber == LottoNumbers[j]){
				RandomNumber=Math.round(0+Math.random()*(9999-0));
				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==3) X[i]='0'+X[i];
	}
	X=X.sort();
	for (i=0; i < X.length; i++){
		OutPut=B+=X[i];
	}
	OutPut = OutPut.replace(/0/g,"<img src='./img/0.png' />");
	OutPut = OutPut.replace(/1/g,"<img src='./img/1.png' />");
	OutPut = OutPut.replace(/2/g,"<img src='./img/2.png' />");
	OutPut = OutPut.replace(/3/g,"<img src='./img/3.png' />");
	OutPut = OutPut.replace(/4/g,"<img src='./img/4.png' />");
	OutPut = OutPut.replace(/5/g,"<img src='./img/5.png' />");
	OutPut = OutPut.replace(/6/g,"<img src='./img/6.png' />");
	OutPut = OutPut.replace(/7/g,"<img src='./img/7.png' />");
	OutPut = OutPut.replace(/8/g,"<img src='./img/8.png' />");
	OutPut = OutPut.replace(/9/g,"<img src='./img/9.png' />");
	document.getElementById("div1").innerHTML = OutPut;
	T=setTimeout('lotto1()',200);
}

so, its like this. i have a function in js file. then i need to echo it into 6 div tag. but when i do it, it only show 1 line a.k.a 1 div in html. what can i do to make it echo all 6 div tag with the function? please help me guys.

<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <link rel="stylesheet" href="firstcss.css">
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <link rel="shortcut icon" href="savonalogo.png" type="image/x-icon">
        <script src="js/jquery-1.7.1.min.js"></script>
        <script src="js/jquery-ui-1.8.18.custom.min.js"></script>
    </head>
    <body>
        <?php
            echo '<script type=\'text/javascript\' src=\'js/rand3.js\'></script>';  

            echo '<div id="div1"></div>';
            echo '<div id="div1"></div>';   
            echo '<div id="div1"></div>';
        ?>              
    </body>
</html>

enter image description here

Comments