document.all ? document.all["RequiredFieldValidator1"] : document.getElementById("RequiredFieldValidator1");很多地方看到这样用
为什么不直接document.getElementById("RequiredFieldValidator1");而要先判断是否支持document.all呢?
IE中不也是支持document.getElementById("RequiredFieldValidator1");的吗?
为什么不直接document.getElementById("RequiredFieldValidator1");而要先判断是否支持document.all呢?
IE中不也是支持document.getElementById("RequiredFieldValidator1");的吗?
所以如果直接用的話有可能會出錯。。
document.getElementById()是标准。近现代的浏览器都支持
而且bug相对较少document.all一般用来判断是浏览器类型的
起码他的适用性远远超过document.all