PDA

View Full Version : How to add an image on back of the result numbers on lottery number picker script



oscardd
06-13-2015, 06:26 PM
1) Script Title: lottery number picker

2) Script URL (on DD): Just testing it!

3) Describe problem: No problem, just want to know if is possible to add an image to the numbers!

Beverleyh
06-14-2015, 08:26 AM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.


just want to know if is possible to add an image to the numbers!What do you mean exactly? After you've filled the gaps from above, it's likely you'll need to copy portions of code from the demo page to demonstrate your edit attempts or provide an image mock-up to illustrate what you're trying to achieve.

vwphillips
06-14-2015, 01:14 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<base href="http://www.vicsjavascripts.org/StdImages/" />
<style type="text/css">
.a1{
position:relative;
font-family:Verdana;
font-size:20px;
color:#888888;
}

.layer1 IMG {
width:50px;
}

</style>

<script language="JavaScript">

/*****************************************
* Lottery Picker (By Kurt at kurt.grigg@virgin.net)
* Featured on/available at http://www.dynamicdrive.com/
* Modified by DynamicDrive.com for below config options
* This notice must stay intact for use.
*****************************************/

var totalnumbers=6 //input total numbers to generate
var lowerbound=1 //input lower bound for each random number
var upperbound=49 //input upper bound for each random number
var images=['0.gif','1.gif','2.gif','3.gif','4.gif','5.gif','6.gif','7.gif','8.gif','9.gif']


function lotto(){
var B='&nbsp;&nbsp;&nbsp;&nbsp; ',LottoNumbers=[],RandomNumber;
for (var i = 1; i <= totalnumbers; i++) {
RandomNumber = Math.round(lowerbound+Math.random()*(upperbound-lowerbound));
for (var 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();
var X=LottoNumbers.split(','),OutPut='';
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 (var i=1; i < X.length; i++){
OutPut+='<img src='+images[X[i].charAt(0)]+' /><img src='+images[X[i].charAt(1)]+' />'+B;
}
document.getElementById("layer1").innerHTML=OutPut;
T=setTimeout('lotto()',20);
//window.status=OutPut;
}

function StOp(){
setTimeout('clearTimeout(T)',1000);
}
//-->
</script></head>

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

</html>