Hi!
I'm trying to update a number in a document with the following code. It
displays a number, a div block with a minus sign and a div block with a
plus sign. When I click the plus sign I want the number to add one to
itself, and when I press minus I want it to subtract one.
This works in Internet Explorer, but nothing happens in Mozilla.
Can any bright head here spot what I'm doing wrong? What here might
Mozilla not like?
<html>
<head>
<title>Add or subtract</title>
<script type="text/javascript">
function change_number(m inus_or_plus){
var number = document.getEle mentById("numbe r");
old_number = parseInt(number .innerText);
if (minus_or_plus === 'minus'){
new_number = (old_number - 1);
number.innerTex t = new_number;
} else if (minus_or_plus === 'plus'){
new_number = old_number + 1;
number.innerTex t = new_number;
}
}
</script>
</head>
<body>
<div id="number">99 </div>
<div style="cursor:h and;" onmousedown="ch ange_number('mi nus')">-</div>
<div style="cursor:h and;" onmousedown="ch ange_number('pl us')">+</div>
</body>
</html>