html js 互转<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #C2D6E0;margin:6px 0 10px 0;">
<tr>
<td class=nav> <strong>HTML源代码转换JavaScript代码工具</strong></td>
</tr>
<tr>
<td style="padding:10px;"> 请将<strong>HTML</strong>源代码拷贝到下面表单中:<BR>
<TEXTAREA id=oSource onpropertychange=change() rows=6 style="width:100%;margin-bottom:6px;"></TEXTAREA>
下面表单中是相应的<strong>JavaScript</strong>代码:<BR>
<TEXTAREA id=oResult ondblclick='this.select();oResult.createTextRange().execCommand("Copy")' title="双击复制" rows=6 style="width:100%;"></TEXTAREA>
<SCRIPT>
function change(){
oResult.value="document.writeln(\""+oSource.value.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\'/g,"\\\'").replace(/\"/g,"\\\"").split('\r\n').join("\");\ndocument.writeln(\"")+"\");"
} </SCRIPT>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #C2D6E0;margin-bottom:10px;">
<tr>
<td class=nav> <b>JavaScript源代码转换HTML代码工具</b></td>
</tr>
<tr>
<td style="padding:10px;"> 请将<strong>JavaScript</strong>源代码拷贝到下面表单中:<BR>
<TEXTAREA id=oResul ondblclick='this.select();oResul.createTextRange().execCommand("Copy")' title=双击复制 onpropertychange=rechange() rows=6 style="width:100%;margin-bottom:6px;"></TEXTAREA>
下面表单中是相应的<strong>HTML</strong>代码:<BR>
<TEXTAREA id=Re ondblclick='this.select();this.createTextRange().execCommand("Copy")' title=双击复制 rows=6 style="width:100%;"></TEXTAREA>
<SCRIPT>
function rechange(){
Re.value=oResul.value.replace(/document.writeln\("/g,"").replace(/"\);/g,"").replace(/\\\"/g,"\"").replace(/\\\'/g,"\'").replace(/\\\//g,"\/").replace(/\\\\/g,"\\")
}
</SCRIPT>
</td>
</tr>
</table>