<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>html\js代码相互转换</title>
<style type="text/css">
textarea{font-size:12px;}
</style>
<script type="text/javascript">
function change(){
document.getElementById('oResult').value="document.writeln(\""+document.getElementById('oSource').value.replace(/\\/g,"\\\\").replace(/\\/g,"\\/").replace(/\'/g,"\\\'").replace(/\"/g,"\\\"").split('\n').join("\");\ndocument.writeln(\"")+"\");"
}
function rechange(){
document.getElementById('ReoResult').value=document.getElementById('ReoSource').value.replace(/document.writeln\("/g,"").replace(/"\);/g,"").replace(/\\\"/g,"\"").replace(/\\\'/g,"\'").replace(/\\\//g,"\/").replace(/\\\\/g,"\\")
}
</script>
</head>

<body>
<div style="width:50%; float:left;"> 请将HTML源代码拷贝到下面表单中: <br />
    <textarea name="oSource" cols="60" rows="20" id="oSource" οnfοcus="change()"  οnkeyup="change()"></textarea>
    <br />
    <br />
  下面表单中是相应的JS代码: <br />
  <textarea name="oResult" cols="60" rows="20" id="oResult" title="双击复制" οndblclick="this.select();oResult.createTextRange().execCommand('Copy')"></textarea>
</div>
<div style="width:50%; float:left;"> 请将Js源代码拷贝到下面表单中: <br />
    <textarea name="ReoSource" cols="60" rows="20" id="ReoSource" οnfοcus="rechange()"  οnkeyup="rechange()"></textarea>
    <br />
    <br />
  下面表单中是相应的HTML代码: <br />
  <textarea name="ReoResult" cols="60" rows="20" id="ReoResult" title="双击复制" οndblclick="this.select();oResult.createTextRange().execCommand('Copy')"></textarea>
</div>
</body>
</html>