»
EnglishFrenchVietnamese

Print - Spaces to Plus Symbol - JavaScriptBank.com

Full version: jsB@nk » Form » Spaces to Plus Symbol
URL: https://www.javascriptbank.com/spaces-to-plus-symbol.html

Spaces to Plus Symbol © JavaScriptBank.comReplaces single or multiple spaces in a text box entry with plus (+) symbols. Handy if your server's form processing or database management program requires this type of encrypted format.

Full version: jsB@nk » Form » Spaces to Plus Symbol
URL: https://www.javascriptbank.com/spaces-to-plus-symbol.html



JavaScript
<SCRIPT LANGUAGE="JavaScript">// Mike McGrath ([email protected])<!-- Beginfunction convertSpaces(str) {var out = "", flag = 0;for (i = 0; i < str.length; i++) {if (str.charAt(i) != " ") {out += str.charAt(i);flag = 0;}else {if(flag == 0) {out += "+";flag = 1;      }   }}return out;}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form>Your Full Name:  <input name=input type=text size=15 onBlur="this.value = convertSpaces(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-->