function - JavaScript/HTML Code In Variables? -


i designing monopoly style digital game , want dice rolling button tried this:

<button class="bttnrolldice" onclick="diceroll()">roll dice</button><h1 id="rollresults"></h1>  <script>     function diceroll() {             var die1 =  math.ceil(math.random() * 7;             var die2 =  math.ceil(math.random() * 7;             document.getelementbyid("rollresults").innerhtml = (die1 + die2); } </script> 

whenever run code, nothing shows below button. can give me hand? (it might have variables equal js code, if tell me how fix this.)

you missing closing parenthesis on math.ceil functions

<button class="bttnrolldice" onclick="diceroll()">roll dice</button><h1  id="rollresults"></h1>  <script>     function diceroll() {        var die1 =  math.ceil(math.random() * 7);        var die2 =  math.ceil(math.random() * 7);        document.getelementbyid("rollresults").innerhtml = (die1 + die2);     } </script> 

Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -