tannerbeck50
11-17-2010, 09:30 PM
Hey guys,
Im kind of a newb and i need help with this dice game im trying to build to help me learn javascript.
If you open up the code up in your browser and click the roll button, it will clear everything and write var a in the top left corner.
What i am trying to do is write the var a into the text box.
any suggestions??
[CODE]
<html>
<head>
<script type="text/javascript">
</script>
<style type="text/css">
body
{
background-image: url(http://projectraw.files.wordpress.com/2010/02/background_brick_wall.jpg);
}
h1
{
font-family:"sans-serif",tahoma;
background-repeat: no-repeat;
color:white;
}
p
{
color:white;
font-family:"sans-serif",tahoma;
font-weight:900;
}
</style>
</head>
<body>
<center><h1>Ghetto Dice Project</h1></center>
<center>
<p>
Hand coded with care by Tanner Beck
</p>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
<p>
<center>
<table BGCOLOR="#888888" BORDER="3" CELLPADDING="5">
<tr>
<input type="text" name="number" size="4" value=a>
</tr>
</br>
<tr>
<button onclick="
a=(Math.floor(Math.random()*13));
document.write(a)">ROLL</button>
</tr>
</table>
</br>
</center>
</p>
</body>
</html>
[CODE]
Im kind of a newb and i need help with this dice game im trying to build to help me learn javascript.
If you open up the code up in your browser and click the roll button, it will clear everything and write var a in the top left corner.
What i am trying to do is write the var a into the text box.
any suggestions??
[CODE]
<html>
<head>
<script type="text/javascript">
</script>
<style type="text/css">
body
{
background-image: url(http://projectraw.files.wordpress.com/2010/02/background_brick_wall.jpg);
}
h1
{
font-family:"sans-serif",tahoma;
background-repeat: no-repeat;
color:white;
}
p
{
color:white;
font-family:"sans-serif",tahoma;
font-weight:900;
}
</style>
</head>
<body>
<center><h1>Ghetto Dice Project</h1></center>
<center>
<p>
Hand coded with care by Tanner Beck
</p>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
</br>
<p>
<center>
<table BGCOLOR="#888888" BORDER="3" CELLPADDING="5">
<tr>
<input type="text" name="number" size="4" value=a>
</tr>
</br>
<tr>
<button onclick="
a=(Math.floor(Math.random()*13));
document.write(a)">ROLL</button>
</tr>
</table>
</br>
</center>
</p>
</body>
</html>
[CODE]