if (document.all)
document.body.style.behavior='url(#default#homepage)';
if (window.sidebar)
javascript 中的这些行是什么意思?谢谢。
最佳答案
Don’t use document.all:
if (document.all) {
element = document.all[id];
else {
element = document.getElementById(id);
}
document.all 是在 Internet Explorer 4 中引入的,因为 W3C DOM 尚未标准化一种使用元素 ID 获取元素引用的方法。
到 IE 5 出现时,document.getElementById() 已经标准化,因此,IE 5 包含了对它的支持。 More info here. .document.body.style.behavior='url(#default#homepage)'
用于将当前页面设置为IE中的首页。if (window.sidebar)
是对 firefox 的检查
关于javascript - javascript中的行是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6757351/