access iframe name from inside iframe

后端 未结 5 1072
感动是毒
感动是毒 2020-12-14 00:28

I though this would be simple enough but I can\'t find the answer. I need to know how I can access an iframe\'s name from within said iframe. I was trying something like thi

5条回答
  •  天涯浪人
    2020-12-14 01:08

    Well, an IFRAME element shouldn't contain anything, it's targeting another document. So using a SCRIPT tag inside an IFRAME doesn't make alot of sense. Instead, use the SCRIPT inside the called document, e.g.

    iframe_caller.html:

    
     
      
     
    
    

    iframe_doc.html:

    
     
      
     
    
    

    Note I'm using parent.document.function() there.

提交回复
热议问题