简体   繁体   English

如何从iframe打开弹出窗口

[英]how to open a popup window from iframe

I am trying to display a popup window from an iframe i have two jsp files main.jsp 我正在尝试从iframe显示弹出窗口,我有两个jsp文件main.jsp

<form name="searchform">
        Search for :<input type="text" id="search"/>                
</form>
<iframe name="popup" src="popup.jsp" height="0" width="0" ></iframe>

and another file popup.jsp 和另一个文件popup.jsp

<html>
    <head>
    <script src="../js/jquery-1.2.6.js"></script>
    <link href="..css/styles.css" rel="stylesheet" type="text/css">
    </style>
    <script>

            $('#search',window.parent.document).keyup(function(){
                var text =$(this).val();
                if(text=="shine"){
                    alert("popup");                 

                }
            });     

    </script>
    </head>
    <body>
        <div id="popupDiv" class="popupDiv">            
            <table  border="0" width="100%" cellspacing="0" cellpadding="0">
                <tr style="background-color: #F72C1B" class="orange1">
                    <td border="0" height="5%" width="30%"> 
                        &nbsp;Choose Options:</td>                  
                    <td border="0" height="5%" width="30%" align="right">
                        <a href="javascript:hideDIV()" style="text-decoration: none">
                         X </a> &nbsp;</td>
                </tr>
                <tr>
                    <table align="center">
                        <tr>
                            <td align="center">popupdata</td>
                        </tr>
    <tr>
                        <td><input type="button" value="Submit" class="orange1" onclick="selectedBoxes();"></td>
                        </tr>   
                    </table>                    
                </tr>               
            </table>
        </div>
    </body>
    </html>

how to show a popup window instead of the alert msg from iframe without modifying main.jsp. 如何在不修改main.jsp的情况下显示弹出窗口而不是来自iframe的警报消息。

Any ideas?

您可以使用window.open代替alert

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM