钢琴曲后半段笛子:if(document.all){} else {}实现了什么功能啊 如果不用else会怎么样?

来源:百度文库 编辑:神马品牌网 时间:2024/04/27 23:08:33
javascript里的代码,
看不懂
完整代码如下:
<SCRIPT language=JavaScript>
<!--
if(document.all){
document.write('<table width="100%" height:287px border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:1px solid #C5C5C5; border-top:0;"><IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor" style=" height:286px;width:100%" frameBorder="0" marginHeight=0 marginWidth=0 src="blankpage.htm"></IFRAME></td></tr></table>');
}else{
document.write('<table width="100%" height:288px border="0" cellspacing="0" cellpadding="0" ><tr><td style="border:1px solid #C5C5C5; border-top:0;background-color:#ffffff"><IFRAME class="HtmlEditor" ID="HtmlEditor" name="HtmlEditor" style=" height:283px;width:100%;margin-left:1px;margin-bottom:1px;" frameBorder="0" marginHeight=0 marginWidth=0 src="blankpage.htm"></IFRAME></td></tr></table>');
}
//-->
</SCRIPT>

if(document.all)

判断是否使用的是ie内核,现在行业中使用的浏览器内核有好几种,每种浏览器又有自己的标准,所以有些时候,必须先判断浏览器,然后根据浏览器给出相应的处理方式,document.all一般只在ie内核的浏览器(如ie,myie,tt)中出现,document.layers在ns浏览器中使用..等..^_^

上面的程序可以这么理解成
if(document.all){s1}else{s2}
如果是ie浏览器的话,执行代码块s1,如果不是ie浏览器,执行代码块s2