JSP以Window形式打开把值从子窗体传回给父窗体 用jquery
首先在父窗体(JSP)引用
下面这个是页面跳转的JS function chooseCustomer(){ var url= "${ctx}/objection.do?method=chooseCustomer"; //转向网页的地址的Action; var name="选择客户信息"; //网页名称,可为空; var iWidth=950; //弹出窗口的宽度; var iHeight=650; //弹出窗口的高度; var iTop = (window.screen.availHeight-30-iHeight)/2; //获得窗口的垂直位置; var iLeft = (window.screen.availWidth-10-iWidth)/2; //获得窗口的水平位置; window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=no,resizeable=no,location=no,status=no'); } 下面一个JS是从子窗体里调用的回调函数 //选择客户的回调函数 function chooseUserCallBack(productid,productname){ $("#CCustomerId").attr("value",productid); //CCustomerId 文体框的ID $("#fourSName").attr("value",productname); } 如:
function sele(id,name){
CGoodsStrengthId = id;
CGoodsStrengthName = name;
}
function checkFather(){
if(null==CGoodsStrengthId || CGoodsStrengthId==""){
alert("请先选择后再提交。");
return;
}
window.openerWindow.chooseUserCallBack(CGoodsStrengthId,CGoodsStrengthName);
window.close();
}
在单选按扭上调用sele();JS 提交的时候调用 就可以了。