admin管理员组文章数量:1023758
I'm doing document.createElement
to insert an iframe, but I'm not able to set allowTransparency
. Here's the code I'm using:
var iframe = document.createElement('iframe');
iframe.className = 'example';
iframe.allowTransparency = 'true';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.width = '260px';
iframe.style.height = '120px';
iframe.style.border = 'none';
iframe.src = '//example/page';
document.body.appendChild(iframe);
But the output, according to Web Inspector, is just:
<iframe class="example" frameborder="0" scrolling="no" style="width: 260px; height: 120px; border: none; " src="//example/page"></iframe>
I'm doing document.createElement
to insert an iframe, but I'm not able to set allowTransparency
. Here's the code I'm using:
var iframe = document.createElement('iframe');
iframe.className = 'example';
iframe.allowTransparency = 'true';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.width = '260px';
iframe.style.height = '120px';
iframe.style.border = 'none';
iframe.src = '//example./page';
document.body.appendChild(iframe);
But the output, according to Web Inspector, is just:
<iframe class="example" frameborder="0" scrolling="no" style="width: 260px; height: 120px; border: none; " src="//example./page"></iframe>
Share
Improve this question
asked Feb 15, 2013 at 22:06
ShpigfordShpigford
25.4k61 gold badges167 silver badges262 bronze badges
2 Answers
Reset to default 9Try this:
iframe.setAttribute('allowtransparency', 'true');
Have you tried this with jQuery? It would be as simple as
$(".example").attr("allowTransparency", "true");
Your Javascript example seems correct.
I'm doing document.createElement
to insert an iframe, but I'm not able to set allowTransparency
. Here's the code I'm using:
var iframe = document.createElement('iframe');
iframe.className = 'example';
iframe.allowTransparency = 'true';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.width = '260px';
iframe.style.height = '120px';
iframe.style.border = 'none';
iframe.src = '//example/page';
document.body.appendChild(iframe);
But the output, according to Web Inspector, is just:
<iframe class="example" frameborder="0" scrolling="no" style="width: 260px; height: 120px; border: none; " src="//example/page"></iframe>
I'm doing document.createElement
to insert an iframe, but I'm not able to set allowTransparency
. Here's the code I'm using:
var iframe = document.createElement('iframe');
iframe.className = 'example';
iframe.allowTransparency = 'true';
iframe.frameBorder = '0';
iframe.scrolling = 'no';
iframe.style.width = '260px';
iframe.style.height = '120px';
iframe.style.border = 'none';
iframe.src = '//example./page';
document.body.appendChild(iframe);
But the output, according to Web Inspector, is just:
<iframe class="example" frameborder="0" scrolling="no" style="width: 260px; height: 120px; border: none; " src="//example./page"></iframe>
Share
Improve this question
asked Feb 15, 2013 at 22:06
ShpigfordShpigford
25.4k61 gold badges167 silver badges262 bronze badges
2 Answers
Reset to default 9Try this:
iframe.setAttribute('allowtransparency', 'true');
Have you tried this with jQuery? It would be as simple as
$(".example").attr("allowTransparency", "true");
Your Javascript example seems correct.
本文标签: javascriptCan39t set allowTransparency when using createElement for iframeStack Overflow
版权声明:本文标题:javascript - Can't set allowTransparency when using createElement for iframe - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745488770a2152867.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论