»
EnglishFrenchVietnamese

Print - Ignore Spaces script - JavaScriptBank.com

Full version: jsB@nk » Utility » Converter » Ignore Spaces script
URL: http://www.javascriptbank.com/ignore-spaces-script.html

Ignore Spaces script © JavaScriptBank.comRemoves spaces from a string variable within a script or from user input into a textbox. Several different uses are shown on the script example page.

Full version: jsB@nk » Utility » Converter » Ignore Spaces script
URL: http://www.javascriptbank.com/ignore-spaces-script.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Mike McGrath (mike_mcgrath@lineone.net) | http://website.lineone.net/~mike_mcgrath<!-- Beginfunction ignoreSpaces(string) {var temp = "";string = '' + string;splitstring = string.split(" ");for(i = 0; i < splitstring.length; i++)temp += splitstring[i];return temp;}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<pre>Before:  String = x xx xxx xxxx<br> After:  String = <script language="JavaScript">document.write(ignoreSpaces("x xx xxx xxxx"));</script></pre><form><input type=text size=25 onBlur="this.value=ignoreSpaces(this.value);"><input type=button value="Ok"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->