父窗口打開一個子窗口,並且父頁面通過傳了id給子頁面,子頁面提供一個模糊搜索功能,然
後點擊搜索後,傳過來的url就消失了,現在的問題是怎麼在jsp把值傳給action,action在把同樣的值傳回來.
以下是父窗口打開子窗口,並把id傳過去
function openNewWindow(id){
window.open("<%=basePath%>user/showUserList.action?id=i_receive",'linkman',"width=260 ,height=345,top=200,left="+((window.screen.width/2)-200));
}
function openNewccWindow(id){
window.open("<%=basePath%>user/showUserList.action?id=i_cc",'linkman',"width=260 ,height=345,top=200,left="+((window.screen.width/2)-200));
}
子窗口得到id
var url = location.search;
s = url.split("=");
url = s[1];
以下是進行模糊搜索
var val = $("#searchInput").val();
window.location = "<%=basePath%>user/searchUserList.action?userName="+encodeURI(val);
請問在模糊搜索後怎麼才能得到原來父窗口中傳過來的那個值
你id就沒有添加到window.open打開的url上。。你自己都寫死了,都不是參數的id
function openNewWindow(id){
window.open("<%=basePath%>user/showUserList.action?id="+id,'linkman',"width=260 ,height=345,top=200,left="+((window.screen.width/2)-200));
}
function openNewccWindow(id){
window.open("<%=basePath%>user/showUserList.action?id="+id,'linkman',"width=260 ,height=345,top=200,left="+((window.screen.width/2)-200));
}
搜索時傳遞的參數也沒有附帶上
var url = location.search;
s = url.split("=");
url = s[1];
var val = $("#searchInput").val();
window.location = "<%=basePath%>user/searchUserList.action?userName="+encodeURI(val)+'&id='+url;