完整代码: [Ctrl A 全选 注:如需引入外部Js需刷新才能执行]脚本说明: 第一步:把如下代码加入区域中 <br><!-- Begin <BR>function changeCase(frmObj) { <BR>var index; <BR>var tmpStr; <BR>var tmpChar; <BR>var preString; <BR>var postString; <BR>var strlen; <BR>tmpStr = frmObj.value.toLowerCase(); <BR>strLen = tmpStr.length; <BR>if (strLen > 0) { <br>for (index = 0; index < strLen; index ) { <BR>if (index == 0) { <BR>tmpChar = tmpStr.substring(0,1).toUpperCase(); <BR>postString = tmpStr.substring(1,strLen); <BR>tmpStr = tmpChar postString; <BR>} <BR>else { <BR>tmpChar = tmpStr.substring(index, index 1); <BR>if (tmpChar == " " && index < (strLen-1)) { <BR>tmpChar = tmpStr.substring(index 1, index 2).toUpperCase(); <BR>preString = tmpStr.substring(0, index 1); <BR>postString = tmpStr.substring(index 2,strLen); <BR>tmpStr = preString tmpChar postString; <BR>} <BR>} <BR>} <BR>} <BR>frmObj.value = tmpStr; <BR>} <BR>// End --> <br> 第二步:把如下代码加入区域中 <!-- Begin function changeCase(frmObj) { var index; var tmpStr; var tmpChar; var preString; var postString; var strlen; tmpStr = frmObj.value.toLowerCase(); strLen = tmpStr.length; if (strLen > 0) { for (index = 0; index < strLen; index++) { if (index == 0) { tmpChar = tmpStr.substring(0,1).toUpperCase(); postString = tmpStr.substring(1,strLen); tmpStr = tmpChar + postString; } else { tmpChar = tmpStr.substring(index, index+1); if (tmpChar == " " && index < (strLen-1)) { tmpChar = tmpStr.substring(index+1, index+2).toUpperCase(); preString = tmpStr.substring(0, index+1); postString = tmpStr.substring(index+2,strLen); tmpStr = preString + tmpChar + postString; } } } } frmObj.value = tmpStr; } // End -->