将CSS添加到iFrame

将CSS添加到iFrame,第1张

将CSS添加到iFrame

基于解决方案您已经找到了如何将CSS应用于iframe?:

var csslink = document.createElement("link") csslink.href = "file://path/to/style.css"; csslink .rel = "stylesheet"; csslink .type = "text/css"; frames['iframe'].document.body.appendChild(csslink);

或更多jqueryish(从使用jQuery将样式表附加到iframe):

var $head = $("iframe").contents().find("head");     $head.append($("<link/>",     { rel: "stylesheet", href: "file://path/to/style.css", type: "text/css" }));


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5440533.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-11
下一篇 2022-12-11

发表评论

登录后才能评论

评论列表(0条)

保存