gpt4 book ai didi

javascript - 如何从 iframe 访问文档中的

转载 作者:太空狗 更新时间:2023-10-29 14:40:16 24 4
gpt4 key购买 nike

enter image description here我有一个 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%'
});

.css()

.find()

.contents()

关于javascript - 如何从 iframe 访问文档中的 <img/>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22952985/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com