是否有任何理由为什么此代码可以在Safari和Chrome,但不IE或FF?JS检测浏览器的宽度和高度在Chrome浏览器和Safari浏览器,但不是IE9或FF9
JS
function load(){
w.value = window.outerWidth;
h.value = window.outerHeight;
}
HTML
<input name="h" id="h" type="hidden" value="" />
<input name="w" id="w" type="hidden" value="" />
Click here for the entire page's source code
预先感谢帮助。
编辑:我想出了什么是错的。必须将以下内容添加到加载功能
var width = document.getElementById("w");
var height = document.getElementById("h");
width.value = window.outerWidth;
height.value = window.outerHeight;
有什么不适合呢?它在做什么,它没有做什么,发生了什么错误等等。 – 2012-02-07 19:50:39