我有一個這樣的網頁...訪問的iFrame網址與jQuery/JavaScript的
<div>
<iframe id="mainContent">
<iframe id="littleBox">
</div>
,我想做到這一點...
$(".someButton").live('click', function() {
alert(/*The URL That the Main Frame is ON*/);
});
我發現這一點:$("#mainFrame").get(0).location.href
,但它不工作...
另外,我需要它返回當前的網址,所以如果有人瀏覽它應該返回它們所在的當前頁面。
這裏同樣的問題問:http://stackoverflow.com/questions/44359/how-do-i-get-the-current-location-of-an-iframe – epascarello 2010-09-14 04:42:07