1

我正在尝试将<script></script>标签添加到iframe头部或身体但无法成功。

var iframe = $("iframe#demo),
    contents = iframe.contents(),
    body = contents.find('body');

尝试一:

var script = document.createElement( 'script' );
script.type = 'text/javascript';
$(body).append(script);

第二次尝试:

$("`<script></script>`").appendTo(contents.find('head'))

上述任何一种方法都不适合我。

让我知道是否有人有一些指针。

谢谢

病毒性的

4

0 回答 0