I would like to add two strings together so that if 7
and 8
Clicks, sets the HTML inside the function output box
to 78
. However, with this current work, it only shows the recently selected number. How can I get it to show every number to be selected?
select the function number (num) {num = num + num // what goes here? Document.getElementById ("Outputbox"). InnerHTML = num; }
& lt; Button onclick = "select no ('7')" & gt; 7 & lt; / Button & gt; & Lt; Button onclick = "selectNum ('8')" & gt; 8 & lt; / Button & gt; & Lt; Button onclick = "selectNum ('9')" & gt; 9 & lt; / Button & gt; & Lt; Button onclick = "selectN ('4')" & gt; 4 & lt; / Button & gt; & Lt; Button onclick = "selectN ('5')" & gt; 5 & lt; / Button & gt; & Lt; Button onclick = "selectN ('6')" & gt; 6 & lt; / Button & gt; & Lt; Button onclick = "selectNum ('1')" & gt; 1 & lt; / Button & gt; & Lt; Button onclick = "selectN ('2')" & gt; 2 & lt; / Button & gt; & Lt; Button onclick = "selectN ('3')" & gt; 3 & lt; / Button & gt;
Try:
var number = ' '; Select the function number (num) {number + = num; Document.getElementById ("Outputbox"). InnerHTML = number; }
No comments:
Post a Comment