RSS
热门关键字:  下载  cms  模版  开源  dedecms

用Javascript转换源代码

来源:Blog 作者:未知 时间:2002-05-18 Tag: 点击:

用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>


最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册