我有一个在iframe中打开的链接列表,例如:
<ul id="frameTrigger">
<li><a target="iframe1" href="aaa.html"><img src="aaa.jpg"></a></li>
<li><a target="iframe1" href="bbb.html"><img src="bbb.jpg"></a></li>
<li><a target="iframe1" href="ccc.html"><img src="ccc.jpg"></a></li>
</ul>
我需要更新另一个div 后 点击链接。具体来说,我需要调用一个检查帧的函数 src
属性并更新div。如果我这样做:
$("#frameTrigger a").click(function() {
var iframe = $("iframe[name=iframe1]").get(0);
console.log(iframe.contentWindow.location.href);
// the problem here is that that the iframe.window.location will
// change AFTER this function returns
});
我没有得到预期的结果。