function toScript(val) { var value = val.value value = value.replace(/\\/gi,"\\\\").replace(/"/gi,"\\\"").replace(/'/gi,"\\\'") valArr = value.split("\r\n") value="" for (i=0; i<valArr.length; i++) { value += (i==0) ? "info =" : "" value += " \"" + valArr[i] value += (i!=valArr.length-1) ? "\" +\"\\n\"+\n" : "\"\n" } value+="\ndocument.write(info)" val.value = value } A [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]