html代码和js代码转换

新建页面 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">&lt;!--
google_ad_client = "ca-pub-4213001413639273";
google_ad_slot = "9449947075";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;</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&amp;&amp;s.handlers,h=H&amp;&amp;H[i],w=this.contentWindow,d;try{d=w.document}catch(e){}if(h&amp;&amp;d&amp;&amp;(!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>

 

页面效果:

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值