Script Categories

Forms >>> Money Filter.

Removes the dollar sign ($) and commas (,) from a a text box. Useful if you require input of only numbers. You may also modify the script to filter out whatever characters you want.


Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function filterNum(str) {
re = /^\$|,/g;
// remove "$" and ","
return str.replace(re, "");
//  End -->
Amount: <input type=text name=amount size=30 value="$1,234,567.99" onBlur="this.form.amount.value=filterNum(this.form.amount.value);">
type=button value="OK" onClick="this.form.amount.value=filterNum(this.form.amount.value);">

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).