function init() { var totalHeight = window.innerHeight || d
function init() {
var totalHeight = window.innerHeight || document.body.clientHeight
var testObj= document.getElementById(‘test‘)
var halfHeight= totalHeight / 2
testObj.style.height = halfHeight+ ‘px‘
}
</javascript>
js设置div高度为浏览器一半
,温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/29951.html