例如:
<input type="text" name="hello" id="hello"/>&&你好
<a href="#" onclick="onformopen('')">Email</a>
<script language="javascript">
function onformopen(){
var hello = document.getElementById("hello").value;
var other = document.getElementById("other").value;
var url = "hello.html?other="+other+"&hello="+hello;
atenaKensakuWin = window.open(url);
}
</script> 我需要传的不只这2个 而且只能用这种办法解决问题 (我自己也很讨厌这需求)哪个哥哥  帮帮我啊  要怎么做 才能把&这个字符处理成地址不理解的关键字啊

解决方案 »

  1.   

    将“var url = "hello.html?other="+other+"&hello="+hello; ”改为“var url = "hello.html?other="+escape(other)+"&hello="+escape(hello); ”或“var url = "hello.html?other="+encodeURI(other)+"&hello="+encodeURI(hello); ”试试。
      

  2.   

    用escape编码,就OK了:
    var url = "hello.html?other="+escape(other)+"&hello="+escape(hello); 
      

  3.   


    var url = "hello.html?other="+other+"&amp;hello="+hello; 
      

  4.   

    方法一:
    <form name="form1" method="get" action="hello.html" target="_blank">
    <input type="text" name="hello">
    </form>
    没有显示的参数用hidden
    调用document.form1.submit();方法二:
    用escape()之类的js方法对value编码
    在hello.html中再用unescape()解码