Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
52
rated 0 times [  55] [ 3]  / answers: 1 / hits: 15888  / 14 Years ago, mon, february 7, 2011, 12:00:00

For example



<input type=text name=disp>
<input type=button name=but0 value=0 onclick=+calc.disp.value=0+>


Here if I click the button 0 means it should display the 0 in text box. If I click the button it should concatenate in that box. But it replaces that is the code is wrong.


More From » html

 Answers
32

As far as I understand it, you want each button click to add 0 to the text box contents. So it starts out empty, and when you push the button the first time, the contents changes to 0. Pushing it a second time changes the contents to 00.



Assuming that's correct, try this:



<input type=text name=disp>
<input type=button name=but0 value=0 onclick=calc.disp.value=calc.disp.value + '0';>

[#93859] Saturday, February 5, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kurtisl

Total Points: 559
Total Questions: 110
Total Answers: 97

Location: Tokelau
Member since Sun, May 7, 2023
1 Year ago
kurtisl questions
;