<div class="htmlarea"> <textarea id="runcode6225"> <title>濾空格</title> <center> <pre> </pre> <font size="2"></font>隨意輸幾個帶空格的字串試試:</center> <center> <form> <input type="text" size="25" onblur="this.value=ignoreSpaces(this.value);"> <input type="button" value="过滤"> </form> </center> </textarea> <br><input onclick="runEx('runcode6225')" type="button" value="运行代码"><input onclick="doCopy('runcode6225')" type="button" value="复制代码"> <input onclick="doSave(runcode6225)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 全選 註:</a>如需引入外部Js需刷新才能執行</div>]<script language="JavaScript"> <!-- 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>