当我按下亚马逊英国按钮时,我正在使用 iFrame 加载http://www.amazon.co.uk,它也在加载,我浏览到 amazon.co.uk 的子页面。现在我想要的是当我将鼠标悬停在此 iFrame 中的标签或链接上时获取标签的 href 属性。是否可以使用 Javascript 或 jQuery 请告诉我如何?
--这就是我正在做的
<div id="amazon_buttons">
<table border="0">
<tr>
<td><a href="../../users/product" target="_top"><input id="cmdback" name="cmdback" type="button" value="Back To IEC" /></a></td>
</tr>
<tr>
<td><input id="cmdanzuk" name="cmdanzuk" type="button" value="Amazon UK" onclick="open_amazon_page('uk')" /> </td>
</tr>
<tr>
<td><input id="cmdanzde" name="cmdanzde" type="button" value="Amazon DE" onclick="open_amazon_page('de')" /> </td>
</tr>
<tr>
<td><input id="cmdanzfr" name="cmdanzfr" type="button" value="Amazon FR" onclick="open_amazon_page('fr')" /> </td>
</tr>
<tr>
<td><input id="cmdanzes" name="cmdanzes" type="button" value="Amazon ES" onclick="open_amazon_page('es')" /> </td>
</tr>
</table>
</div>
<iframe id="azn_iframe" name="azn_iframe" src="" style="clear: both; width: 100%; height:800px;"></iframe>
$("#azn_iframe").contents().find("a").hover( function () { alert($(this).attr("href")); }); function open_amazon_page($platform) { if($platform == 'uk') azn_iframe.location.href = "http://www.amazon.co.uk"; else if($platform == 'de') azn_iframe.location.href = "http://www.amazon.de"; else if($platform == 'fr') azn_iframe.location.href = "http://www.amazon.fr"; else if($platform == 'es') azn_iframe.location.href = "http://www.amazon.es"; } </script>