Script Categories

Miscellaneous >>> Modify Variable.

Removes a character from a variable's value in a string. For example, if you tell it that number equals 0.09876 and to remove the period, afterwords number equals 009876.

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
var number = "0.09876"; // previous value
var removechar = "."; // character to remove from string

document.write("<b>Initially, number equals</b> " + number);

dec = number.indexOf(removechar);
tmp = number.substring(0,dec);
tmp += number.substring(dec+1,number.length);
number = tmp; // number now equals converted value

document.write("<br><b>Now, number equals</b> " + number);
//  End -->

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!).