You are here: irt.org | FAQ | JavaScript | Number | Q363 [ previous next ]
Simple. Multiply by 100 and then round:
<SCRIPT LANGAUGE="JavaScript"><!-- function percent(x) { return Math.round((x-0)*100) + '%'; } document.write(percent(.5) + '<BR>'); document.write(percent(.25) + '<BR>'); document.write(percent('0.13333') + '<BR>'); //--></SCRIPT>