新建页面 convert.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.toolarea
{
color: #333333;
display: block;
height: 250px;
margin: 8px 0;
padding: 4px;
width: 720px;
}
</style>
</head>
<body>
<div id="l">
<!-- /title -->
<div class="content-a">
<div class="toolcode">
<!-- /工具开始 -->
<script language="JavaScript">
function rechange() {
document.getElementById('re').value = document.getElementById('oresult').value.replace(/document.writeln\("/g, "").replace(/"\);/g, "").replace(/\\\"/g, "\"").replace(/\\\'/g, "\'").replace(/\\\//g, "\/").replace(/\\\\/g, "\\")
}
function change() {
document.getElementById('oresult2').value = "document.writeln(\"" + document.getElementById('osource').value.replace(/\\/g, "\\\\").replace(/\\/g, "\\/").replace(/\'/g, "\\\'").replace(/\"/g, "\\\"").split('\n').join("\");\ndocument.writeln(\"") + "\");"
}
</script>
<h2>
HTML转JS代码工具</h2>
<h3>
请将Html源代码粘贴到下面表单中:</h3>
<textarea onkeyup="change()" onfocus="change()" id="osource" class="toolarea"></textarea>
<h3>
下面表单中是相应的Js代码:</h3>
<textarea id="oresult2" class="toolarea"></textarea><br>
<h2>
JS转HTML代码工具</h2>
<h3>
请将Js源代码粘贴到下面表单中:</h3>
<textarea onkeyup="rechange()" onfocus="rechange()" id="oresult" class="toolarea"></textarea>
<h3>
下面表单中是相应的Html代码:</h3>
<textarea id="re" class="toolarea"></textarea>
<!-- /工具结束 -->
</div>
<div class="ny728x90">
<script> dy("ny728x90");</script>
<script type="text/javascript"><!--
google_ad_client = "ca-pub-4213001413639273";
google_ad_slot = "9449947075";
google_ad_width = 728;
google_ad_height = 90;
//--></script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
<ins style="display: inline-table; border: none; height: 90px; margin: 0; padding: 0;
position: relative; visibility: visible; width: 728px; background-color: transparent">
<ins style="display: block; border: none; height: 90px; margin: 0; padding: 0; position: relative;
visibility: visible; width: 728px; background-color: transparent" id="aswift_1_anchor">
<iframe width="728" scrolling="no" height="90" frameborder="0" style="left: 0; position: absolute;
top: 0;" name="aswift_1" id="aswift_1" onload="var i=this.id,s=window.google_iframe_oncopy,H=s&&s.handlers,h=H&&H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&&d&&(!d.body||!d.body.firstChild)){if(h.call){setTimeout(h,0)}else if(h.match){try{h=s.upd(h,i)}catch(e){}w.location.replace(h)}}"
allowtransparency="true" hspace="0" vspace="0" marginheight="0" marginwidth="0">
</iframe>
</ins></ins>
</div>
<div class="tag">
<script> dy("ny468x15");</script>
</div>
</div>
<!-- /content -->
</div>
</body>
</html>
页面效果: