jquery iframe与父页面的互动

iframe页内找父页元素

$("#yourIdSelector",window.parent.document)

iframe页内调用父页方法或变量

parent.yourfunctionName
parent.yourVar

反过来,父页操作iframe

查找元素:

$(this).contents().find("#yourIdSelector")

调用方法:

$("#frameSelector").find("iframe")[0].contentWindow.yourFunctionName()

点赞

发表评论

电子邮件地址不会被公开。必填项已用 * 标注