<html>
<head>
<title> Die Rolls </title>
<script type="text/javascript">
function SelectImage()
// Assumes: die images are in balance3e.com/Images
// Results: displays a randomly selected image for 2 6-sided die
{
roll=Math.floor(Math.random()*6) + 1;Math.floor(Math.random()*6) + 1;
imgName='http://balance3e.com/Images/die' + roll + '.gif';
document.getElementById('dieImg').src = imgName;
}
</script>
</head>
<body>
<div style="text-align:center">
<p>
<img id="dieImg" alt="die image"
src="http://balance3e.com/Images/die1.gif">
</p>
<input type="button" value="Click to Roll" onclick="SelectImage();">
<img id="dieImg" src="http://balance3e.com/Images/die1.gif">
<input type="button" value="Click to Roll" onclick="SelectImage();">
</div>
</body>
</html>
Need to make both dice roll when i click each button confused on how to make this work.
This post has been edited by Dormilich: 04 October 2012 - 10:51 PM
Reason for edit:: fixed code tags

New Topic/Question
Reply


MultiQuote





|