how do I button clicked before outputting the results?
<p>So there're 2 radio items and I want the user to choose which one to execute, after the user chooses one of them, he/she will click on the button "Draw!" and will output the result from one of the function of the radio item they chose. But I can't figure out how to call either function and wait until the user clicks on the "Draw!" button to actually calls the function.</p>

<p>I have in my HTML:</p>

<pre><code>&lt;p&gt;
Do you want to &lt;input type="radio" name="draw" id="draw" value="drawTriangle"&gt;Draw Triangle
or
&lt;input type="radio" name="draw" id="draw" value="drawZigZag"&gt;Draw ZigZag&lt;br&gt;
&lt;input type="button" value="Draw!" onclick="drawEither()"&gt;
&lt;/p&gt;

&lt;pre id="outputTriangle"&gt;
&lt;/pre&gt;

&lt;pre id="outputZigZag"&gt;
&lt;/pre&gt;
</code></pre>

<p>and Javascript: </p>

<pre><code>function makeZigZag () {
var sizeTextField = document.getElementById('sizeTextField')
//block of codes
drawButton.onclick = function () {
    outputTri.innerHTML = makeTriangle(sizeTextField.value);
};

}

function makeTriangle () {
var sizeTextField = document.getElementById('sizeTextField')
//block of codes
drawButton.onclick = function () {
    outputZZ.innerHTML = makeTriangle(sizeTextField.value);
};
}

function drawEither () {
outputTri = document.getElementById('outputTriangle');
outputZZ = document.getElementById('outputZigZag');
}
</code></pre>
