可以: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;
};
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;
};
var s = Request("id");
alert(s)
</script>
window.onload=function(){
var s = location.search;
s = s.substr(1,s.length-1);
alert(s)
}
</SCRIPT>
而alert(ID)时,告诉我ID为undefined,而不是xx。
这是为什么呢,请高人指导
var id="xx"
window.showModalDialog("test.htm?id=xx",window);test.htm
var s = window.dialogArguments;
var ID = s.id;
alert(ID)
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。
哎,真愁人。。