Javascript > Show what Answered is
<p>Ok, so I'm making a website for tutorials with JS and I'm working on a mini test on it. I'm wondering how I would go about adding a function that would tell the user on a popup window the correct answer and what they answered. I already have coded the correct answer, but I'm stuck with how I would create a function specifying in the popup box what they answered. </p>

<p>Here is the progress so far:</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Javascript Tutorials - Review 1&lt;/title&gt;
&lt;script type="text/javascript"&gt;
function show_alert()
{
alert("1. Correct Answer is: True" );
alert("2. Correct Answer is: True");
alert("3. Correct Answer is: True");
}
&lt;/script&gt;
&lt;link rel="stylesheet" type="text/css" href="style.css" /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="wrapper"&gt;
&lt;div id="header"&gt;
&lt;div id="logo"&gt;
&lt;h1&gt;&lt;a href="index.html"&gt;Javascript Tutorial&lt;/a&gt;&lt;/h1&gt;
&lt;/div&gt;
&lt;div id="slogan"&gt;
&lt;h2&gt;Javascript Tutorial covering concepts&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="menu"&gt;
&lt;ul&gt;
&lt;li class="first current_page_item"&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="struct.html"&gt;Structured Programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="sequence.html"&gt;Sequence Structure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="comparison.html"&gt;Pseudocode, JS and Flowcharts&lt;/a&gt;&lt;/li&gt;
&lt;li class="last"&gt;&lt;a href="Workscited.html"&gt;Credits&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br class="clearfix" /&gt;
&lt;/div&gt;
&lt;div id="splash"&gt;
&lt;img class="pic" src="http://i.imgur.com/pCvZ4.png" width="870" height="230" alt="" /&gt;
&lt;/div&gt;
&lt;div id="page"&gt;
&lt;div id="content"&gt;
&lt;div class="box"&gt;
&lt;h2&gt;Welcome to Javascript Tutorials 
&lt;p&gt;
This is &lt;strong&gt;Javascript&lt;/strong&gt;,  quiz and test for the Three Control Structures.
&lt;p&gt;Comparing Pseudocode, JavaScript and Flowcharts&lt;/p&gt;
&lt;h3&gt;Flowcharts can describe the same processes and information.&lt;/h3&gt;
&lt;form name="threecont"&gt;
&lt;input type="radio" name="option1contr" value="1"/&gt;True&lt;br /&gt;
&lt;input type="radio" name="option1contr" value="2" /&gt;False.&lt;br /&gt;
&lt;p&gt;Psuedocode and flowcharts are both tools to help you develop the logic for an algorithm?&lt;/p&gt;
&lt;input type="radio" name="option2contr" value="4"/&gt;True&lt;br /&gt;
&lt;input type="radio" name="option2contr" value="5" /&gt;False&lt;br /&gt;
&lt;p&gt;IPO stands for Processing and output?&lt;/p&gt;
&lt;input type="radio" name="option2contr" value="7."/&gt;True&lt;br /&gt;
&lt;input type="radio" name="option2contr" value="8" /&gt;False&lt;br /&gt;
&lt;input type="button" onclick="show_alert()" value="Submit" /&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;div class="box" id="content-box1"&gt;
&lt;ul class="section-list"&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br class="clearfix" /&gt;
&lt;/div&gt;
&lt;div id="sidebar"&gt;
&lt;div class="box"&gt;
&lt;h3&gt;Navigation&lt;/h3&gt;
&lt;ul class="list"&gt;
&lt;li class="first"&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="struct.html"&gt;Structured Programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="sequence.html"&gt;Sequence Structure&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="comparison.html"&gt;Pseudocode, JS and Flowcharts&lt;/a&gt;&lt;/li&gt;
&lt;li class="last"&gt;&lt;a href="Workscited.html"&gt;Credits&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="box"&gt;
&lt;h3&gt;Javascript Test Review&lt;/h3&gt;
&lt;div class="date-list"&gt;
&lt;ul class="list date-list"&gt;
&lt;li class="first"&gt;&lt;span class="date"&gt;2/21&lt;/span&gt; &lt;a href="review1.html"&gt;Review Structured Programming&lt;/a&gt;&lt;/li&gt;
&lt;li class="first"&gt;&lt;span class="date"&gt;2/21&lt;/span&gt; &lt;a href="review2.html"&gt;Review Sequence Structure&lt;/a&gt;&lt;/li&gt;
&lt;li class="first"&gt;&lt;span class="date"&gt;2/21&lt;/span&gt; &lt;a href="review3.html"&gt;Review Comparsion Quiz&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br class="clearfix" /&gt;
&lt;/div&gt;
&lt;div id="page-bottom"&gt;
&lt;div id="page-bottom-content"&gt;
&lt;h3&gt;Javascript Tutorials&lt;/h3&gt;
&lt;p&gt;
This website covers very basic Javascript chapters we've covered within class, the goal is to educate
computer users on our content that we have covered so far.
&lt;/p&gt;
&lt;/div&gt;
&lt;div id="page-bottom-sidebar"&gt;
&lt;h3&gt;Links&lt;/h3&gt;
&lt;ul class="list"&gt;
&lt;li class="first"&gt;&lt;a href="struct.html"&gt;Structured Programming&lt;/a&gt;
&lt;li&gt;&lt;a href="sequence.html"&gt;Sequence Structure&lt;/a&gt;&lt;/li&gt;
&lt;li class="last"&gt;&lt;a href="comparison.html"&gt;Pseudocode, JS and Flowcharts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br class="clearfix" /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
