我有下面的html,我的iframe ID是動態生成的,現在我想更改我的span的html。如何使用jquery更改iframe中的html
<a title="Visit Us on Google+" id="gPlus" class="addthis_button_google_plusone at300b" g:plusone:count="false">
<div id="___plusone_0">
<iframe width="100%" scrolling="no" frameborder="0" hspace="0" marginheight="0" marginwidth="0"
style="position: static; top: 0px; width: 24px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 15px;"
tabindex="0" vspace="0" id="I0_1363080003291" name="I0_1363080003291"
src="https://plusone.google.com"
allowtransparency="true" data-gapiattached="true" title="+1">
<html lang="en" dir="ltr">
<head>
</head>
<body class="g-rba-Dh-kQa ">
<div class="Bg" dir="ltr" id="plusone">
<span id="widget_bounds"><table cellspacing="0" cellpadding="0"><tbody><tr><td>
<div class="ZRa">
<span tabindex="0" role="button" title="" class="hAa Ro Bg" id="button" aria-label="Click here to publicly +1 this." aria-pressed="false"><div class="YIa"></div></span></div></td></tr></tbody></table></span></div>
</body>
</html>
</iframe>
</div>
</a>
現在我想在「標題」標籤添加一些值使用jQuery
<div class="ZRa">
<span tabindex="0" role="button" title="" class="hAa Ro Bg" id="button" aria-label="Click here to publicly +1 this." aria-pressed="false"><div class="YIa"></div></span>
</div>
請建議!
同源策略到位。您無法更改來自其他域的頁面標記。 – BenM 2013-03-12 10:14:43
@BenM,這裏沒有跨域,因爲你的html在你的頁面上呈現,然後你需要編寫一些jquery函數,它會發現iframe並將其更改爲html,請建議! – 2013-03-12 10:19:33
但是iframe的'src'是'plusone.google.com'? – BenM 2013-03-12 10:20:24