我正在document.createElement
插入一个 iframe,但我无法设置allowTransparency
. 这是我正在使用的代码:
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.com/page';
document.body.appendChild(iframe);
但根据 Web Inspector 的说法,输出只是:
<iframe class="example" frameborder="0" scrolling="no" style="width: 260px; height: 120px; border: none; " src="//example.com/page"></iframe>