Sal*_*n A 11 javascript jquery javascript-events
我有一个在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>
Run Code Online (Sandbox Code Playgroud)
单击链接后,我需要更新另一个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
});
Run Code Online (Sandbox Code Playgroud)
我没有得到预期的结果.
归档时间: |
|
查看次数: |
22524 次 |
最近记录: |