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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -