莫小柒 发表于 2014-5-24 10:12

jshtml代码如何转为text文本

<script type="text/javascript">
function saveCode(obj) {
        var winname = window.open('', '_blank', 'top=10000');
        winname.document.open('text/html', 'replace');
        winname.document.writeln(obj.value);
        winname.document.execCommand('saveas','','code.txt');
        winname.close();
}
</script>
<a href="javascript:saveCode(document.getElementById('CODE_7643'))" ></a><br><textarea class="code_main" id="CODE_7643" style="overflow-y:auto;overflow-x:hidden;height:150px;width:100%">fgdfgd;lfg
三届大师父都是飞行速度发
dfkjsdkfjlsdkfjlskjdflsdjfldsfsdf
sdflksdlfjldskjfklsdjflkdsjfklsdjflsdkjflsdfj
sdfkljdslkfjkldsjfklsdjfkdsjfkdsjfksdjflsdf
sfdlsdjflsdkjflsdkjflsdkjflsdkjflsdfjldsf
sfsdlfjsdlfjsdlkfjwoeiruwieruieworuioewurio
dsfds;fkl;sdfkdsl;f;ldsfldsfklsdkfldskflds;kfl;sdfkweporiwoepriweop</textarea>
页: [1]
查看完整版本: jshtml代码如何转为text文本