How to create dynamic function in javascript?

JAVASCRIPT Can you help me make two dice roll at the same time?

  • I need to make two dice roll at the same time in this javascript file. But when I create a second die, and click roll the button, only the first die will roll. I need both of them to roll simultaneously. What should I do to my code for it to work?? Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>Rolling A Die in JavaScript</title> <style type="text/css"> #dice { font-family: Symbola, Code2000, DejaVu Sans, Droid Sans Fallback, EversonMono, STIXGeneral, Quivira, Unicode BMP Fallback SIL ; line-height: 2em; font-size: 300%; } form { background: transparent; border: none; } </style> </head> <body> <h1>Rolling A Die in JavaScript</h1> <p>You need a font containing Unicode dice characters to see this demonstration as intended.</p> <h2>The demo</h2> <form action="" onsubmit="start();return false"> <div><input type="submit" value="Roll"></div> <div><span id="dice">⚀</span><span id="dice">⚀</span></div> </form> <script type="text/javascript"> function roll() { document.getElementById('dice').innerH... = String.fromCharCode(0x2680+Math.floor(... String.fromCharCode(0x2680+Math.floor(... } var countdown_number; function go() { if(countdown_number > 0) { countdown_number--; roll(); if(countdown_number > 0) { countdown = setTimeout('go()', 100); } } } function start() { countdown_number = 10; go(); } </script> </body> </html>

  • Answer:

    You need to sort out your variables first.

R33sez-P!3sez at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

You need to sort out your variables first.

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.