access iframe name from inside iframe

后端 未结 5 1073
感动是毒
感动是毒 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:30

    You were nearly right. Setting the name attribute on a frame or iframe sets the name property of the frame's global window object to that string. (Not parent, which refers to the window of the document that owns the frame.)

    So unless some other script has deliberately changed the name, it's as simple as:

    1.html:
    
    
    2.html:
    
    

提交回复
热议问题