<script>
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
}
</script>
<input type=button value="将 HTML 转为 JavaScript" onclick=toScript(document.all["code"])><br>
<textarea id=code cols=75 rows=20>
<table width="300">
<tr><td align="right">A</td></tr>
</table></textarea>
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
}
</script>
<input type=button value="将 HTML 转为 JavaScript" onclick=toScript(document.all["code"])><br>
<textarea id=code cols=75 rows=20>
<table width="300">
<tr><td align="right">A</td></tr>
</table></textarea>
标签:
将HTML自动转为JS代码
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“将HTML自动转为JS代码”评论...