I need help Incrementing a value in a textBox in HTML & JavaScript, can someone help?

  • Thread starter Thread starter Unknown_Ace
  • Start date Start date
U

Unknown_Ace

Guest
Here's what I'm trying to do, it seems really easy, and normally I could do as easy as this, but for some odd reason, I can't do it, and IDK why, can you please look at this and tell me what I've done wrong or what needs to be done in order to fix and solve this problem I'm having?


<html>
<head>
<title>A Can Calculator</title>
</head>
<body>

<h3>A Can Calculator</h3><br>

<form name = "myFRM">
<input type = "text" name = "CanAMNT" value = "0">

<input type = "button" name = "myBTNA"
value = "Add A Can" onclick = "addCAN()">

<input type = "button" name = "myBTNB"
value = "Start Over" onclick = "ClearCans()">
</form>

<script language = "javascript">

function addCAN()
{
document.myFRM.CanAMNT.value = 0.05++;
}

function ClearCans()
{
document.myFRM.CanAMNT.value = 0;
}

</script>
</body>
</html>

Any help would be very much appreciated, thank you.
This is bull-shlt and I just can't seem to figure it out...

I've built allot better apps then this one, but for some reason, I just can't figure this crap out, it should be so darn easy, and I can't get it, and IDK why...
 
I don't know what you're trying to do, so I don't know how much I can help you, but it seems that addCAN() would set the value of CanAMNT to 1.05 every time, as x++ always returns a value of x+1. Maybe you meant to write document.myFRM.CanAMNT.value+=0.05. I'm not sure if you wanted it to do this or not, or what kind of error you're getting so I can't say for sure.
 
Back
Top