1.window.frames["iframe的id"].contentDocument.getElementsByClassName("mycontainer")
2.document.getElementById('myiframe').contentWindow.document.getElementsByClassName("mycontainer")
3.$(window.frames["iframe的id"].contentDocument.documentElement).find(".mycontainer")
4.$("#myiframe").contents().find(".mycontainer")
本文介绍了四种不同的方法来获取HTML页面中iframe内的指定类名的元素。这些方法包括使用原生JavaScript以及jQuery库函数实现。适用于前端开发者进行iframe内容操作。
2041

被折叠的 条评论
为什么被折叠?



