M
Morten Snedker
If my question is off this group, please point me in the right
direction.
Here goes:
My scipt fails between alert-2 and alert-3 with
"Object doesn't support this property or method" (freely translated
from Danish).
Any idea what could be wrong?
The code is a rip-off from
http://xaprb.com/articles/number-formatting-demo.html.
<script language="javascript" type="text/javascript" >
function fNr(context){
alert("1");
var val = (context == null) ? new Number(this) : Math.abs(this);
alert("2");
var arr = val.round(2).toFixed(2).split(',');
alert("3");
arr[0] = (val < 0 ? '-' : '') + String.leftPad((val < 0 ?
arr[0].substring(1) : arr[0]), 1, '0');
alert("4");
arr[0] = Number.addSeparators(arr[0]);
alert("5");
arr[0] = Number.injectIntoFormat(arr[0].reverse(), '0###',
true).reverse();
alert("6");
arr[1] = Number.injectIntoFormat(arr[1], '00', false);
alert("7");
return arr.join(',');
}
</script>
Regards /Snedker
direction.
Here goes:
My scipt fails between alert-2 and alert-3 with
"Object doesn't support this property or method" (freely translated
from Danish).
Any idea what could be wrong?
The code is a rip-off from
http://xaprb.com/articles/number-formatting-demo.html.
<script language="javascript" type="text/javascript" >
function fNr(context){
alert("1");
var val = (context == null) ? new Number(this) : Math.abs(this);
alert("2");
var arr = val.round(2).toFixed(2).split(',');
alert("3");
arr[0] = (val < 0 ? '-' : '') + String.leftPad((val < 0 ?
arr[0].substring(1) : arr[0]), 1, '0');
alert("4");
arr[0] = Number.addSeparators(arr[0]);
alert("5");
arr[0] = Number.injectIntoFormat(arr[0].reverse(), '0###',
true).reverse();
alert("6");
arr[1] = Number.injectIntoFormat(arr[1], '00', false);
alert("7");
return arr.join(',');
}
</script>
Regards /Snedker