|
↑
Forms >>>
Removes spaces from a string variable within a script or from user input into a text box. Several different uses are shown on the script example page.
Before: String = x xx xxx xxxx
After: String =
Or, try entering a string with spaces in this box.
Add the below code to the <body> section of your page:
<script
language="javascript"
type="text/javascript">
function
ignoreSpaces(string)
{
var
temp =
"";
string
=
''
+
string;
splitstring
=
string.split("
");
for(i
=
0;
i <
splitstring.length;
i++)
temp
+=
splitstring[i];
return
temp;
}
</script>
<pre>
Before: String = x xx xxx xxxx<br>
After: String =
<script
language="JavaScript">
document.write(ignoreSpaces("x
xx xxx xxxx"));
</script>
</pre>
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>
|
↓ Bitcoin Gambling Site . http://www.cashadvance-loans.net/
|