Please Help I am trying to make a counter that when i click a button it adds .01 to a running total. Below is the code I have created but when i click on the button it adds one and deletes the bid button

<input name = "count2" type = "text" value = "$0.00">
<input type = "button" value = "Bid" onclick = "addhour()">
<script type = "text/javascript">

var count = 0
var count2 = 00
function addhour() {
count2 ++;

document.write("$" + count + ".0" + count2);


You need to learn the differences between Java programming language and JavaScript as scripting language.

Thread moved to correct section

To use document.write() successfully, the statement must execute immediately.

Any call to document.write() after the page has fully loaded will cause the entire page DOM, CSS, Javascript - everything - to be completely blitzed, and replaced with the argument passed to document.write().

Your document.write() is embedded in a function which not executed immediately. Instead, it is executed in response to a user interaction after the page has loaded.

Result - BLITZ!