用Javascript转换源代码

来源:互联网 发布:淘宝上卖食品怎么认证 编辑:程序博客网 时间:2024/05/26 02:54
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

用Javascript转换源代码


源代码如下:

<textarea style="width:500;height:200" name="n1">
例子:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;无标题文档&lt;/title&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;
&lt;/head&gt;
&lt;body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea><br>
<input type="button" onclick="txt=document.all.n1.value;hh()" value="转换">

<script>

txt="";txt2="";txt3="";num=0
function hh(){
document.all.n1.value=Math.floor(num/txt.length*100)+"%"
txt3=txt.charAt(num)
if(txt3 == " "){txt3="&nbsp;"};if(txt3 == "&"){txt3="&amp;"};if(txt3 == """){txt3="&quot;"};if(txt3 == "<"){txt3="&lt;"};if(txt3 == ">"){txt3="&gt;"}
txt2=txt2+txt3
num++;if(num != txt.length){setTimeout("hh()",1)};else{document.all.n1.value=txt2}
}
</script>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击