由于我的第一次尝试曲解了您的问题,因此请尝试以下 *** 作:
<script>$(function () { $("iframe").not(":has([src])").each(function () { var ifrm = this; ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentdocument.document) ? ifrm.contentdocument.document : ifrm.contentdocument; ifrm.document.open(); ifrm.document.write($(this).attr("alt")); ifrm.document.close(); });});</script>
这将读取任何不具有src属性或具有空白值的src属性的iframe的“ alt”标记值,并将alt文本写入该iframe的主体中。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)