当前位置:开发者网络 >> 网页特效 >> 代码生成 >> 内容
精彩推荐
分类最新特效
分类热点特效
  
html转换成js工具
日期:2005-02-25   人气:   【字体: 】【收藏此文


<!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! -->
<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

请将html源代码拷贝到下面表单中: <br>
<textarea cols="100" rows=8 id="oSource" onpropertychange="change()" ></textarea>
<br>
下面表单中是相应的JS代码: <br />
<textarea cols="100" rows=8 id="oResult" title="双击复制" ondblclick='this.select();oResult.createTextRange().execCommand("Copy")'></textarea>
<br>
<script>
function change(){
oResult.value="document.writeln(\""+oSource.value.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\'/g,"\\\'").replace(/\"/g,"\\\"").split('\r\n').join("\");\ndocument.writeln(\"")+"\")"
} </script>