LoginSignup
9
8

More than 5 years have passed since last update.

JavaScriptでiframeを生成&枠線を消すには

Last updated at Posted at 2013-01-22

JavaScriptでiframeを生成、さらにsetAttributeで枠線消す属性を設定する時の罠。

iframe.setAttribute('frameBorder', 0);

「frame*Border」と書かないと、IE7以前*は言うことを聞いてくれません。古いIEは爆発すればいい。

追記(2013-01-23)

なお、frameBorder Property経由だとこんな感じ。

var i = document.createElement('iframe');
i.frameBorder = '0';
// i => <iframe frameborder=​"0">​</iframe>​

noromanba@githubさんにご指摘いただきました。感謝!

しかし、なんかこっちの方が大文字/小文字を慎重に書く気がする…

9
8
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
8