<!-- TWO STEPS TO INSTALL IGNORE SPACES:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Mike McGrath (
[email protected]) -->
<!-- Web Site:
http://website.lineone.net/~mike_mcgrath -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!!
http://javascript.internet.com -->
<!-- Begin
function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<center>
<pre>
Before: String = x xx xxx xxxx<br>
After: String = <script language="JavaScript">
document.write(ignoreSpaces("x xx xxx xxxx"));
</script>
</pre>
</center>
<!-- Or, here is another example, in a form -->
<p>
<center>
Or, try entering a string with spaces in this box.
<form>
<input type=text size=25 onBlur="this.value=ignoreSpaces(this.value);">
<input type=button value="Ok">
</form>
</center>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.30 KB -->