Formater et tal til to ciffre
jeg vil gerne give mine intranet brugere muligheden for at bruge deres mousewheel til at angive klokken i et formfelt.Problemet er bare at den må ikke skrive 0,1,2,3,4,5,6,7 eller 9, men skal skrive 00, 01 osv...
<SCRIPT LANGUAGE="JavaScript">
<!--
var verticalDistance = 0;
function countRotations(addRotations) {
addRotations += event.wheelDelta/120;
return addRotations;
}
function shifTime() {
verticalDistance = countRotations(verticalDistance);
if (verticalDistance < 0) {
verticalDistance = 0;
}
if (verticalDistance > 24) {
verticalDistance = 24;
}
s = verticalDistance;
document.MyForm.hest.value = verticalDistance;
}
// -->
</SCRIPT>
<form name=MyForm onmousewheel=shifTime();>
<input name=hest value=00>
</form>