how to remove number one by one in the calculator text box using JavaScript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dev saini

    #1

    how to remove number one by one in the calculator text box using JavaScript?

    how to remove number one by one in the calculator text box using JavaScript. its urgent
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    please provide more information - what calculator? what box ... probably you should provide a snippet of code ... so that a reader could follow that issue ...

    Comment

    • Bharat383
      New Member
      • Aug 2011
      • 93

      #3
      html:
      Code:
      <form>
      			<input type="text" name="display_screen" value="" id="display_screen" />
      			<br />			
      			<input type="button" name="btn_1" value="1" onclick="add_value(this.value)"/>
      			<input type="button" name="btn_2" value="2"  onclick="add_value(this.value)"/>	
      			<input type="button" name="btn_3" value="3"  onclick="add_value(this.value)"/>
      			<br />
      			<input type="button" name="btn_4" value="4"  onclick="add_value(this.value)"/>
      			<input type="button" name="btn_5" value="5"  onclick="add_value(this.value)"/>
      			<input type="button" name="btn_6" value="6"  onclick="add_value(this.value)"/>
      			<br />
      			<input type="button" name="btn_7" value="7"  onclick="add_value(this.value)"/>
      			<input type="button" name="btn_8" value="8"  onclick="add_value(this.value)"/>
      			<input type="button" name="btn_9" value="9"  onclick="add_value(this.value)"/>
      			<br />
      			<input type="button" name="btn_10" value="0"  onclick="add_value(this.value)"/>
      			<input type="button" name="btn_12" value="."  onclick="add_value(this.value)"/>
      			<input type="button" name="btn_11" value="00"  onclick="add_value(this.value)"/>
      			<br />
      			<input type="submit" name="submit" value="SUBMIT" />
      			<input type="reset" name="reset" value="CLEAR" />					
      	</form>
      javascript
      Code:
      	<script type="text/javascript">
      		function add_value(tmp)
      		{
      				document.getElementById("display_screen").value =document.getElementById("display_screen").value + tmp; 		
      		}
      	</script>
      Last edited by Niheel; May 17 '12, 04:03 PM. Reason: Bharat, please use code tags and explain the solution.

      Comment

      Working...