R
ReidarT
I have a javascript where I try to add 1 to a value through a button and
show the value in a textbox
and subtract 1 from another button and show the result in the same
textfield.
This seems to work with subtraction but the addition just treats it like a
string .
If the value is in the label is 22 and I press the Add-button, I get 2222.
When I click the subtract button I get 2221 (the correct value)
<script language="javascript" type="text/javascript">
function LeggTil() {
var Tall = document.Form1.lblDayHtml.value;
var Tall2 = Tall + 1;
document.Form1.lblDayHtml.value = Tall2;
}
function TrekkFra() {
var Tall = document.Form1.lblDayHtml.value;
var Tall2 = Tall - 1;
document.Form1.lblDayHtml.value = Tall2;
}
</script>
regards
Rehiaa
show the value in a textbox
and subtract 1 from another button and show the result in the same
textfield.
This seems to work with subtraction but the addition just treats it like a
string .
If the value is in the label is 22 and I press the Add-button, I get 2222.
When I click the subtract button I get 2221 (the correct value)
<script language="javascript" type="text/javascript">
function LeggTil() {
var Tall = document.Form1.lblDayHtml.value;
var Tall2 = Tall + 1;
document.Form1.lblDayHtml.value = Tall2;
}
function TrekkFra() {
var Tall = document.Form1.lblDayHtml.value;
var Tall2 = Tall - 1;
document.Form1.lblDayHtml.value = Tall2;
}
</script>
regards
Rehiaa