/    Sign up×
Community /Pin to ProfileBookmark

Can any one help with the following
Three dice
Dice #1 has the following numbers 1,2,2,3,3,3
Dice #2 has the following numbers 0,0,1,2,3,4
Dice #3 has the following numbers 0,1,2,3,4,5

I have the following how do I change it to work for my purpose:

<!– TWO STEPS TO INSTALL DICE ROLLER:

  • 1.

    Paste the first code into the HEAD of your HTML document –>

  • 2.

    Add the last coding into the BODY of your HTML document –>

  • <!– STEP ONE: Paste the first code into the HEAD of your HTML document –>

    <HEAD>

    <SCRIPT LANGUAGE=”JavaScript”>
    <!– Original: Michael Hensley ([email protected]) –>
    <!– Web Site: [url]http://geocities.com/TimesSquare/Castle/6274[/url] –>

    <!– This script and many more are available free online at –>
    <!– The JavaScript Source!! [url]http://javascript.internet.com[/url] –>

    <!– Begin
    var die = 6;
    var dice = 3;
    function dice_roll(die, dice) {
    var roll = 0;
    for (loop=0; loop < dice; loop++) {
    // random number fix by George Johnston ([email protected])
    roll = roll + Math.round(Math.random() * die) % die + 1;
    }
    document.form.text.value = roll;
    }
    // End –>
    </script>

    <!– STEP TWO: Add the last coding into the BODY of your HTML document –>

    <BODY>

    <center>
    <form name=form>
    <table border=2 cellpadding=5>
    <tr>
    <td colspan=2 align=middle>What dice type?</td>
    <td colspan=2 align=middle>How many dice to roll?</td>
    </tr>
    <tr>
    <td valign=top align=middle>
    <p><input type=radio name=sides onclick=”die = 3″>3 Sided
    <p><input type=radio name=sides onclick=”die = 4″>4 Sided
    <p><input type=radio name=sides onclick=”die = 5″>5 Sided
    <p><input type=radio checked name=sides onclick=”die = 6″>6 Sided
    <p><input type=radio name=sides onclick=”die = 8″>8 Sided
    </td>
    <td valign=top align=middle>
    <p><input type=radio name=sides onclick=”die = 10″>10 Sided
    <p><input type=radio name=sides onclick=”die = 12″>12 Sided
    <p><input type=radio name=sides onclick=”die = 20″>20 Sided
    <p><input type=radio name=sides onclick=”die = 30″>30 Sided
    <p><input type=radio name=sides onclick=”die = 100″>100 Sided
    </td>
    <td valign=top align=middle>
    <p><input type=radio name=number onclick=”dice = 1″>1
    <p><input type=radio name=number onclick=”dice = 2″>2
    <p><input type=radio checked name=number onclick=”dice = 3″>3
    <p><input type=radio name=number onclick=”dice = 4″>4
    <p><input type=radio name=number onclick=”dice = 5″>5
    </td>
    <td valign=top align=middle>
    <p><input type=radio name=number onclick=”dice = 6″>6
    <p><input type=radio name=number onclick=”dice = 7″>7
    <p><input type=radio name=number onclick=”dice = 8″>8
    <p><input type=radio name=number onclick=”dice = 9″>9
    <p><input type=radio name=number onclick=”dice = 10″>10
    </td>
    </tr>
    <tr>
    <td align=middle colspan=4>
    <input type=button value=”Roll Dice” name=button onclick=”dice_roll(die, dice)”>
    <input type=text size=10 name=text>
    </td>
    </tr>
    </table>
    </form>
    </center>

    <p><center>
    <font face=”arial, helvetica” size=”-2″>Free JavaScripts provided<br>
    by <a href=”http://javascriptsource.com”>The JavaScript Source</a></font>
    </center><p>

    <!– Script Size: 2.57 KB –>

    to post a comment
    JavaScript

    3 Comments(s)

    Copy linkTweet thisAlerts:
    @vi5inJun 25.2005 — What is it you want to do? What are "your purposes"?
    Copy linkTweet thisAlerts:
    @mstaup_woh_rr_cauthorJun 25.2005 — I want to u se it to play an old 1972 board game, I need something because I can not find the dice.
    Copy linkTweet thisAlerts:
    @BigMoosieJun 25.2005 — Thats so basic it is easiest to write it from scratch:

    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
    &lt;HTML lang="en"&gt;
    &lt;HEAD&gt;
    &lt;TITLE&gt;Dice&lt;/title&gt;
    &lt;META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
    &lt;META name="Content-Script-Type" content="text/javascript"&gt;
    &lt;SCRIPT type="text/javascript"&gt;
    &lt;!--
    function rollDice(){
    function r(){return Math.floor(Math.random()*5);}
    var r1=[1,2,2,3,3,3][r()];
    var r2=[0,0,1,2,3,4][r()];
    var r3=[0,1,2,3,4,5][r()];
    document.getElementById("output").innerHTML="Dice: " +r1+", "+r2+", "+r3+"&lt;BR&gt;Total: "+(r1+r2+r3);
    }
    //--&gt;
    &lt;/SCRIPT&gt;
    &lt;/HEAD&gt;
    &lt;BODY&gt;

    &lt;FORM onsubmit="rollDice();return false;"&gt;
    &lt;DIV&gt;&lt;INPUT type="submit" value="Roll Dice"&gt;&lt;/DIV&gt;
    &lt;/FORM&gt;
    &lt;DIV id="output"&gt;&lt;/DIV&gt;

    &lt;/BODY&gt;
    &lt;/HTML&gt;
    ×

    Success!

    Help @mstaup_woh_rr_c spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.5,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...