当我按下亚马逊英国按钮时,我正在使用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>