可以:var Request = function(arg){
var ws = location.search.substring(1, location.search.length);
var arrReturn = new Array();
var strReturn = new String(); if (ws != ""){
var val = ws.split("&");
for (i=0 ; i<val.length ; i++){
if (arg == val[i].split("=")[0]){
strReturn = val[i].split("=")[1];
break;
}
else{
arrReturn.push(val[i].split("=")[1]);
}
}
}
return (typeof arg == 'undefined')?arrReturn:strReturn;
};

解决方案 »

  1.   

    text :<script>
     var s = Request("id");
     alert(s)
    </script>
      

  2.   

    主页面中 window.showModalDialog("test.htm?id=xx")test.htm 中<SCRIPT LANGUAGE="JavaScript">
    window.onload=function(){
    var s = location.search;
    s = s.substr(1,s.length-1);
    alert(s)
    }
    </SCRIPT>
      

  3.   

    楼上的都可行,location.search 就可以了
      

  4.   

    为什么我这样弄不能解决呢?主界面:先求出id=“xx”;再使用window.showModalDialog(test.htm?id=xx)定位到test.htm界面在test.htm中,用 var s = window.dialogArguments;  var ID = s.id;
    而alert(ID)时,告诉我ID为undefined,而不是xx。
    这是为什么呢,请高人指导
      

  5.   

    主界面
    var id="xx"
    window.showModalDialog("test.htm?id=xx",window);test.htm
    var s = window.dialogArguments;
    var ID = s.id; 
    alert(ID)
      

  6.   

    恩,刚才少打了一个window,就是如hookee说的:主界面是一个js文件,其中一个函数中定义的: 
    var id="xx" 
    window.showModalDialog("test.htm?id=xx",window); 在test.htm 
    var s = window.dialogArguments; 
    var ID = s.id;  
    alert(ID)
    这种写法,告诉我ID为undefined,而不是xx。
    哎,真愁人。。