我在父页面中用了一个javascript函数:
<script>
function getCustomer() {
var h=(screen.height-580)/2;
var w=(screen.width-480)/2;
window.open ("customerlist.jsp", "newwindow", "height=580, width=480, top="+h+",left="+w+",toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");}
</script>
意在子窗口中返回值,给父窗口。
子窗口的返回函数如下:
function cc()
{
var aa = document.getElementsByName("customer");
var customer;
for (var i=0; i<aa.length; i++)
{
if(aa[i].checked){
opener.document.getElementById('customername').value=aa[i].value;
window.close();
}
}
alert("must choose a customer");
}
运行过程中值可返回,但是子窗口不能按预想的关闭,并且还弹出alert,实在不解,请大虾开释。
alert点掉后,子窗口变成空白,父窗口正确结果。
<script>
function getCustomer() {
var h=(screen.height-580)/2;
var w=(screen.width-480)/2;
window.open ("customerlist.jsp", "newwindow", "height=580, width=480, top="+h+",left="+w+",toolbar =no, menubar=no, scrollbars=no, resizable=no, location=no, status=no");}
</script>
意在子窗口中返回值,给父窗口。
子窗口的返回函数如下:
function cc()
{
var aa = document.getElementsByName("customer");
var customer;
for (var i=0; i<aa.length; i++)
{
if(aa[i].checked){
opener.document.getElementById('customername').value=aa[i].value;
window.close();
}
}
alert("must choose a customer");
}
运行过程中值可返回,但是子窗口不能按预想的关闭,并且还弹出alert,实在不解,请大虾开释。
alert点掉后,子窗口变成空白,父窗口正确结果。
解决方案 »
- mysql数据库显示汉字乱码
- 关于尚学堂OA数据库字典!!!!
- java 实现http post multipart/form-data 如何实现! 谢谢了
- java中经常用的设计模式都是什么模式?
- 请问怎么使用struts显示session中username的内容?感谢
- 上传文件如何改名保存呀? 急!!!!(分不多不好意思)
- 请问下面这种情况下上载的文件名子怎么得到???
- Unable to load configuration. - action - file:老是出这个问题,求大神解释
- 关于eclipse的简单问题
- JSP两个问题请教?
- 传说中的JSP木马!JSP资源管理器.
- 华为公司 java面试题,大家一起讨论 我想能够把这些问题搞定进华为应该没问题
......
if(aa[i].checked){
opener.document.getElementById('customername').value=aa[i].value;
window.close();
return;
}......
如果有检查一下你window.close前面的代码!
另外,你去掉浏览器"选项"中"高级"中的"禁止脚本调试"相关项前的勾选,然后关闭重启浏览器再测试,此时若有脚本错误会弹出错误框,你若安装visual stadio 6还可以使用其中的工具进行音频调试!
若有脚本错误会弹出错误框,你若安装visual stadio 6还可以使用其中的工具进行单步调试!