如何在另一个jsp页面中将一个jsp页面显示为弹出窗口

时间:2018-06-15 14:58:14

标签: javascript html jsp

以下是我的Current.jsp页面代码,我需要在点击图像名称为" ok"的图像后弹出myWindow.jsp页面。以下是代码。我是jsp和java脚本的新手因此无法继续任何帮助将不胜感激。 Current.jsp如下:

   <script language="JavaScript" type="text/javascript">
        MyFunction=function()
        {
        window.location.href='../../path/myWindow.jsp';
        }
        </script>
        <TABLE width="100%" border="0" cellspacing="0" cellpadding="0" id="textcopy" bgcolor="#E5E5CC"> <TBODY> <TR valign="bottom">
        <TD width="10%" class="copytable" align="right" height="30" valign="bottom">
        <DIV id="hideButton" class="hideButton">
        <input type="image" accesskey="O" border="0" name="ok" id="ok" src="images/nav/ok.gif" width="73" height="22" hspace="2" alt="OK" onmouseover="if (document.activeElement.id != this.id) {this.src='./images/nav/ok_s.gif'; }" onclick="javascript:MyFunction()" tabindex="<%= String.valueOf(tabIndex++) %>">
        </DIV></TD><TBODY></TABLE>

以下是myWindow.jsp

 var myWindow = window.open("", "myWindow", "height=200", width=200");
        myWindow.document.write(<!DOCTYPE html>);
        myWindow.document.write(<html><head>
        <body><table width=100, height=100, border=0>
        <tr>
        );
        myWindow.document.write(<td>Statement Description</td>);
        myWindow.document.write(<td><input type='text' name='myFormtext' /></td>);
        myWindow.document.write( <td><DIV><input type="image" accesskey="O" border="0" name="ok"
        id="ok" src="images/nav/ok.gif" width="73" height="22" hspace="2"
        alt="OK"
        onmouseover="if (document.activeElement.id != this.id) { this.src='./images/nav/ok_s.gif'; }"
        onmouseout="if (document.activeElement.id != this.id) { this.src='./images/nav/ok.gif'; }"
        onfocus="this.src='./images/nav/ok_s.gif'"
        onblur="this.src='./images/nav/ok.gif'"
        tabindex="<%= String.valueOf(tabIndex++) %>">
        </DIV></TD>
        <TD width="10%" class="copytable" align="right" height="30"
        valign="bottom"></td>);
        myWindow.opener.document.write(
        </tr>
        </table>
        </body> </head> </html>);

0 个答案:

没有答案