Homework help - Javascript coin jar
<p>Our teacher asked us to create a jar of coins that will count how many pennies, dimes, and etc we have and then gives a total amount of money.</p>

<p>this is the template that he want us to use </p>

<pre><code>https://online.pcc.edu/content/enforced/70599-22278.201302/labs/frameworks/Lab4Template.html?_&amp;d2lSessionVal=0Zb6SMZBBcQ8ENPN4HdQk4js0
</code></pre>

<p>He want us to enter pennies, nickels, dimes, quarters in the same text box separated by comma.  My question is, How can I do that? I don't know how to do that in JavaScript. Can anyone lead me in the right direction.</p>

<p>here is the code</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
    &lt;title&gt; 122 Lab 4 Template &lt;/title&gt;
    &lt;meta name="author" content="Lee Middleton" /&gt;
    &lt;meta name="keywords" content="CIS122" /&gt;
    &lt;meta name="description" content="CIS 122 Lab 4" /&gt;
    &lt;link rel="stylesheet" type="text/css" href="/content/enforced/70599-22278.201302/labs/frameworks/../../new122_Style.css?_&amp;amp;d2lSessionVal=FeMQRN1p4YNBW7SRb8H38sRQW" /&gt;
    &lt;style type="text/css"&gt;
        .container {
            border: 1px solid black;
            border-radius: 15px;
            width: 350px;
            margin: 25px auto;
            padding: 10px;
        }
        .result {
            width: 175px;
            float: left;
        }
        p { margin: 5px 0 0 5px;}
        .clear { clear: both; }
        input[type='button'] {
            margin: 10px 0 0 5px;
        }
    &lt;/style&gt;
    &lt;script language="javascript"&gt;
        function countCoins()
        {
            // Add your code here to count the coins and display your answers
        }
    &lt;/script&gt;

&lt;script type="text/javascript" src="/d2l/common/mathjax/2.0/MathJax.js?config=MML_HTMLorMML%2c%2fd2l%2flp%2fmath%2fdisplay%2fconfig.js%3fv%3d9.4.1000.156-10" &gt;&lt;/script&gt;&lt;/head&gt;

&lt;body&gt;
&lt;h1&gt;CIS 122 Lab 4&lt;/h1&gt;
&lt;div class="container"&gt;
&lt;h2&gt;SORT-O-COIN&lt;/h2&gt;
&lt;form name="clubForm" style="margin-bottom: 10px;"&gt;
&lt;div style="margin-left: 10px;"&gt;Coin Jar &lt;input name="coinJar" size="40" type="text" /&gt;&lt;/div&gt;
&lt;p&gt;Number of pennies: &lt;span name="pennies"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Number of nickels: &lt;span name="pennies"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Number of dimes: &lt;span name="pennies"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Number of quarters: &lt;span name="pennies"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Number of half-dollars: &lt;span name="pennies"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Total number of coins: &lt;span name="totalCoins"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Total value: &lt;span name="totalValue"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;input value="Count the coins" onclick="countCoins()" type="button" /&gt;&lt;/form&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
