0
我试图用iframe中的图像替换“注销”文本(注释部分)。用图像替换Iframe中的文本
我已经试过几件事情,但我认为这是最接近于正确的:
$("#comment-editor").contents().find("Sign out").html("<img src="http://3.bp.blogspot.com/-sJ_cc0hh_jw/TtllFIQ-NSI/AAAAAAAAEM4/zJdS8K9rjZ4/s1600/index.gif" alt="Sign out" />");
#comment-editor
是iframe的ID。 “退出”是我想要替换的文本,虽然它的即时HTML结构如下:
<span id="signoutLink">
<span id="commentDash" style="display: none;">–</span>
<a target="_top" href="http://xxxxxx.blogspot.com/logout?d=http://www.blogger.com/logout-redirect.g?blogID%3D4240883138904129005%26postID%3D3175710312324737334">Sign out</a>
</span>
什么我错在这里做什么?
可能试图绕过[同源策略(http://en.wikipedia.org/wiki/Same_origin_policy)。 – jmeas
如果iframe源不是来自同一个域,那么您将无法更改内容 - 演示 - http://fiddle.jshell.net/s9p7a/3/ – coderplus