Access a variable of iframe from parent

后端 未结 6 921
野趣味
野趣味 2020-12-03 09:35

script of iframe


script of parent window



        
6条回答
  •  Happy的楠姐
    2020-12-03 10:07

    Using contentWindow instead of contentDocument works for me:

    var check = document.getElementById("iframeid").contentWindow.a;
    

    Also, ensure that the domains match and that you are using a webserver to test (I got a protocol warning when testing from the file system).

提交回复
热议问题