您的位置:首页 > 其它

url 汉字乱码全方位解析

2011-11-07 18:26 295 查看
<html>
<head>
<script>

var encode = escape('排行');
alert(encode);
alert('排行');
function covert(){
var z = document.getElementById('dd').value;
document.getElementById('ecode').value = escape(z);
}
function uncovert(){
var z = document.getElementById('dd1').value;
document.getElementById('ecode1').value = unescape(z);
}

function encodeURIComponent1(){
alert('ddd');
var z = document.getElementById('dd2').value;
document.getElementById('ecode2').value = encodeURIComponent(z);
}
function encodeURI1(){
var z = document.getElementById('dd3').value;
document.getElementById('ecode3').value = encodeURI(z);
}

function decodeURI1(){
var z = document.getElementById('dd4').value;
document.getElementById('ecode4').value = decodeURI(z);
}

</script>
</head>
<body>
<br/>
<input id = 'dd' type ="text" value ='' style="width:100px;"/>
<input id= "button" type ="button" value="转换" onclick="covert();"/>
<input id = 'ecode' type ="text" value =''/>
<br/>
<input id = 'dd1' type ="text" value =''/>
<input id= "unbutton" type ="button" value="反转换" onclick="uncovert();"/>
<input id = 'ecode1' type ="text" value =''/>
<br/>
<input id = 'dd2' type ="text" value =''/>
<input id= "unbutton1" type ="button" value="encodeURIComponent" onclick="encodeURIComponent1();"/>
<input id = 'ecode2' type ="text" value =''/>
<br/>
<input id = 'dd3' type ="text" value =''/>
<input id= "unbutton2" type ="button" value="encodeURI" onclick="encodeURI1();"/>
<input id = 'ecode3' type ="text" value =''/>
<br/>
<input id = 'dd4' type ="text" value =''/>
<input id= "unbutton3" type ="button" value="decodeURI" onclick="decodeURI1();"/>
<input id = 'ecode4' type ="text" value =''/>

<a id = "a1" href = "a.html?id=排行">a</a>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: