红色的注释encodeURIComponent是关键。
<html><head><meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
<script>
function qs()
{
el=document.mainform.chinese;
if (window.RegExp && window.encodeURIComponent)
{
var qe=encodeURIComponent(el.value);
prompt("Transmit",qe);
window.location.href="http://www.google.com/search?q="+qe+"&sourceid=firefox&start=0&start=0&ie=utf-8&oe=utf-8";
}
}
// -->
</script>
<body>
<form name="mainform">
<input type="text" name="chinese"><input type="button" value="Trasmition" onclick="qs()">
</form>