Javascript or script for superscript pricing
Hello,
I'm creating a price template where the "$" and cents are superscript. I'm using the script:
var f=this.getField("field") f.richText = true; var spans = new Array(); spans[0] = new Object(); spans[0].text = "$"; spans[0].superscript = true; var fDollars = Math.floor (event.value); spans[1] = new Object(); spans[1].superscript = false; spans[1].text = util.printf("%.0f", fDollars); var fCents = event.value % 1; fCents *= 100; spans[2] = new Object(); spans[2].superscript = true; spans[2].text = util.printf ("%02.0f", fCents); event.richValue = spans;
But when there's no cent's the script automatically adds a "00" when the cents isn't entered. Is there a way to hide the superscript "00" when cents isn't entered? i.e. Field enter 99.00 to show as $99" and not "$99 00"