Javascript cross window interaction

后端 未结 3 1401
执笔经年
执笔经年 2021-01-15 20:20

I have this very simple Javascript to write on a text area when the link is clicked:




        
3条回答
  •  孤城傲影
    2021-01-15 20:42

    Ok, I wrote you a sample you can check at http://jsfiddle.net/zzdAL/

    $(document).ready(function()
                      {
                          popup = window.open("http://fiddle.jshell.net");
                          $("#input1").click(function() {
                              try {
                                    popup.document.window.alert(1);
                              }
                              catch (e) { alert(e.message); }
                          });
                      }
                     );
    

    It only runs an alert on the popup, but you can do whatever you want with the popup, assuming you have the necessary rights (needs to be the same domain I believe).

    The most simple is to write a function in your popup and call it from the opener.

提交回复
热议问题