点了一个按钮,另一个就不好用了....
渣新求解
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>字符编码转换</title>
<style>
.box {
width:45%;
border-style:outset;
background-color:#EEEEEE;
}
.textbox {
float:left;
width:45%;
}
.A {
color:#FF0000;
}
.B{
color:#FF8000;
}
.C{
color:#FFFF00;
}
.D{
color:#00FF00;
}
.E{
color:#00FFFF;
}
.F{
color:#0000FF;
}
.G{
color:#8000FF;
}
a {
text-decoration:none;
}
.hrA {
height:2px;
background:-webkit-linear-gradient(left,#FF0000,#FF8000,#FFFF00,#80FF00,#00FF00,#00FF80,#00FFFF,#0000FF);
background:-o-linear-gradient(right,#FF0000,#FF8000,#FFFF00,#80FF00,#00FF00,#00FF80,#00FFFF,#0000FF);
background:-moz-linear-gradient(right,#FF0000,#FF8000,#FFFF00,#80FF00,#00FF00,#00FF80,#00FFFF,#0000FF);
background:linear-gradient(to right,#FF0000,#FF8000,#FFFF00,#80FF00,#00FF00,#00FF80,#00FFFF,#0000FF);
}
</style>
</head>
<body>
<center>
<h1>
<a href="javascript:history.back(0)">
<strong class="A">U</strong>
<strong class="B">n</strong>
<strong class="C">i</strong>
<strong class="D">c</strong>
<strong class="E">o</strong>
<strong class="F">d</strong>
<strong class="G">e</strong>
<br />
<strong class="A">字</strong>
<strong class="B">符</strong>
<strong class="C">编</strong>
<strong class="D">码</strong>
<strong class="E">转</strong>
<strong class="F">换</strong>
<strong class="G">器</strong>
</a>
</h1>
<div class="hrA"></div>
<br />
<b>Native</b>
<br />
<textarea id="YZL" class="box" rows="20px"></textarea>
<br />
<br />
<b>Unicode</b>
<br />
<textarea id="LYZ" class="box" rows="20px"></textarea>
<div>
<input type="button" value="Unicode" onclick="Unicode()" />
<input type="button" value="Native" onclick="Native()" />
</div>
<br />
</center>
<script type="text/javascript">
var yzltext=document.getElementById("YZL").value;
var yzl=document.getElementById("YZL");
var length=yzl.length;
var lyztext=document.getElementById("LYZ").value;
var lyz=document.getElementById("LYZ");
function Unicode(){
yzltext=document.getElementById("YZL").value;
length=yzltext.length;
lyz=document.getElementById("LYZ");
lyz.innerHTML=null;
for(var t=0;t<length;t++){
lyz.innerHTML+="&#"+yzltext.charCodeAt(t)+";";
}
}
function Native(){
lyztext=document.getElementById("LYZ").value;
yzl=document.getElementById("YZL");
yzl.innerHTML=lyztext;
}
</script>
</body>
</html>
![](//img1.sycdn.imooc.com/5775255600019f8902790279-100-100.jpg)
Yzl_Produce
浏览 945回答 0
打开App,查看更多内容