2013-08-06 20 views
1

我試圖從一個iframe顯示彈出窗口打開一個彈出窗口,我有兩個JSP文件 main.jsp中如何從IFRAME

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

和其他文件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> 

如何在不修改main.jsp的情況下顯示彈出窗口而不是來自iframe的警報消息。

Any ideas? 
+0

什麼彈出? '#popupDiv'? – putvande

+0

@putvande感謝您的重播可以詳細說明,我必須顯示popupDiv從popup.jsp – Bhaskar

+0

這不僅僅像用'$('#popupDiv')替換alert(「popup」);'show(show );'或者我錯過了這一點? – putvande

回答

-2

可以使用window.open代替alert

+0

請解釋你的downvote,OP聲明他想要一個彈出窗口,有什麼更好的嗎? – mguimard

+0

我認爲OP沒有'不想要這樣的彈出窗口。 – putvande