<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!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=gb2312" />
<title>encodeURI测试</title>
</head>

<body>
<input type=text id='uri'>
<input type=button onclick="encode()" value="编码">
<select id="funselect" size="1">
<option value="encodeURI" selected="selected">encodeURI</option>
<option value="encodeURIComponent">encodeURIComponent</option>
</select>
<script>
window.$ = window.document;
function encode()
{
var value=$.getElementById('uri').value;
var opt = $.getElementById('funselect');
var fun = opt.options(opt.selectedIndex).value;
var uri1= encodeURI(value);
var uri2= encodeURIComponent(value);
if(fun=='encodeURI')
alert(uri1);
else
alert(uri2);
show.innerHTML ="";
show.innerHTML += "encodeURI:
"+uri1+"<p>" + "encodeURIComponent:"+uri2;
}
</script>
<div id=show></div>
</body>
</html>





























"+uri1+"<p>" + "encodeURIComponent:"+uri2;






