模式窗口中无法转向

主窗口A用showModalDialog模式弹出窗口B,处理完毕后,再转到窗口C,发现窗口C总是在新窗口中弹出,但我希望是在窗口B中直接转向窗口C,各个文件代码如下:

A.htm
<html>
<body>
<input value="1" type="button" onclick="window.showModalDialog('B.htm', window, '');">
</body>
</html>

B.htm
<html>
<head>
  <base target="_self" />
</head>
<body>
<input value="2" type="button" onclick="document.location.href='B2.htm';">
<input value="3" type="button" onclick="window.location.href='B2.htm';">
<input value="4" type="button" onclick="window.location.reload('B2.htm');">
<input value="5" type="button" onclick="dialogArguments.showModalDialog('B2.htm', '', ''); window.close();">
</body>
</html>

C.htm
<html>
<body>
OK
</body>
</html>

最后是按钮5有效,它其实先要求A.htm把父窗口做为参数传过来,然后B.htm里面操作父窗口打开C.htm,并关闭本窗口。

原文地址:https://www.cnblogs.com/yzx99/p/1388047.html