position: absolute 居中显示
<div id="certBox" style="display: none;width: 1000px;height: 650px;z-index: 999999999;margin: auto;
background-color: blue;position: absolute">
<button onclick="hideSsl()">关闭</button>
</div>
<script>
function showSsl() {
var certBoxDom = document.getElementById('certBox');
var bodyDomArr = document.getElementsByTagName('body');
if(certBoxDom === undefined || bodyDomArr === undefined){
return;
}
var getBody = bodyDomArr[0].offsetWidth;
certBoxDom.style.display = 'block';
certBoxDom.style.left = (getBody-1000)/2+"px";
}
function hideSsl() {
var certBoxDom = document.getElementById('certBox');
if(certBoxDom === undefined){
return;
}
certBoxDom.style.display = 'none';
}
</script>