2012-04-03 68 views
6

对于此行代码:IE FRAMEBORDER替代

<iframe width="600" height="400" frameBorder="0" src="http://stackoverflow.com"></iframe>​ 

我得到这个错误:(validator.w3.org:XHTML 1.0过渡)

there is no attribute "frameBorder" 

我使用frameBorder因为IE8创建内联框架上的某种边界。在最新的Chrome/Firefox上没问题。

有没有其他的W3C有效的方式来移除IE8上的边界表单iframe

+0

可能重复的[IE 8 iframe边框问题](http://stackoverflow.com/questions/1625835/ie-8-iframe-border-问题) – Ben 2012-04-03 00:36:46

回答

-1

xhtml中的所有属性均为小写。试试这个:

<iframe width="600" height="400" frameborder="0" src="http://stackoverflow.com"></iframe>​ 
+2

'frameborder'也不被验证器允许。 – 2012-04-12 14:58:14

0

由于W3C不excecuting的Javascript,你可以使用Javascript后来添加的属性。

实施例使用jQuery:

$('iframe').attr("frameBorder", 0); 
4

只需使用CSS:

<iframe width="600" height="400" style="border:none;" src="http://www.google.com"></iframe> 

P.S.我假设你在你的iFrame标签中使用了stackoverflow作为例子?因为该网站不允许被i-framed,它似乎...