我有一个 iframe
<iframe src="../Images/landingpage.jpg" id="Iframe1" name="ifrmContent" class="ifrmClass">
</iframe>
我在 inspector 元素中发现 img 标签位于带有 body 标签的“#document”
<html>
<body style="margin: 0px;">
<img style="-webkit-user-select: none;" src="../Images/landingpage.jpg">
</body>
</html>
我需要访问此 img("landingpage.jpg") 以更改(图像很小..需要调整大小)其宽度为 100% 和高度:90%
我试过使用 #Iframe1>#document>html>body>img{width:100%;}
最佳答案
尝试
$("#Iframe1").contents().find("img").css({
'width': '100%',
'height': '90%'
});
关于javascript - 如何从 iframe 访问文档中的 <img/>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22952985/