主页面用window.showModalDialog的时候,如果直接打开其它系统的页面,这时候别人的页面在window.returnValue=1;这样返回值的时候,主页面是取不到返回值的,原因就是因为跨域了.
解决办法如下:
1,首先主页面testMain.jsp先打开一个中转页面,
Java代码
<html>
<head>
</head>
<body>
<input type="button" value="test" onclick="test();"/>
</body>
</html>
<script type="text/javascript">
function test() {
var paramObj = new Object();
//弹出模式窗口,集成页面
var ret_Value = window.showModalDialog("testFrame.jsp",paramObj,"scroll:no;resizable:yes;Minimize:no;Maximize:yes;dialogHeight:700px;dialogWidth:1024px;");
alert("返回值---" + ret_Value);
}
</script>

2,中转页面testFrame.jsp中要有一个iframe,然后把其它系统要打开的页面(这里的例子就是http://192.168.1.120:8080/test.jsp)放在这个iframe中,这里用一个FORM来存放要提交的数据,代码如下:
Java代码
<html>
<body>
<form ).submit();
}
</script>

 

亲测可用

 

 参考:http://download.csdn.net/download/hefang0711/7239985

相关文章:

  • 2022-12-23
  • 2021-12-06
  • 2021-06-07
  • 2021-11-17
  • 2021-11-16
  • 2021-12-07
  • 2021-12-16
  • 2021-09-30
猜你喜欢
  • 2021-12-03
  • 2021-04-18
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
相关资源
相似解决方案