<!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>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>js 实现中文的uri编码_www.jb200.com</title>
<mce:script type="text/
javascript"><!--
function test(){
var str = document.getelementbyid("srcstr").value;
var strtouri = encodeuricomponent(str);
document.getelementbyid("strtouri").innerhtml = strtouri;
var uritostr = decodeuri(strtouri);
document.getelementbyid("uritostr").innerhtml = uritostr;
}
// --></mce:script>
</head>
<body>
<p>要转换的文字:
<input type="text" id="srcstr" />
</p>
<p>
传换成的uri代码:
<textarea cols="30" rows="3" id="strtouri">