-2
I have a code that generates a random number is to appear in div = value, right away. But I wanted this div to become invisible and after I click on the button it appears speak the value and disappear soon after. Does anyone know how to create it?
<html>
<body bgcolor="black"></body>
<script>
function rollDice() {
var roll = Math.floor(Math.random() * 20) + 1;
valor.innerHTML = roll;
}
</script>
<input type="button" value="Click" id="clickbutton" onclick="rollDice()">
<div id="valor" class="dice">00</div>
<style>
@import url('http://fonts.cdnfonts.com/css/cmu-typewriter-text');
#valor {
font-family:'CMU Typewriter Text', sans-serif;
font-size: 60px;
border: none;
border-bottom:1px solid Grey;
color: White;
position: absolute;
top: 1%;
left: 1%;
}
#clickbutton {
position: absolute;
top: 7%;
left: 7%;
}
</style>
</html>
but there’s still a problem, when the value goes away it goes forever, when clicka again in the input the value doesn’t seem anymore, has how to solve?
– almeidaab