Javascript 如何在document.getElementById()上添加样式
我有一个加载程序图像显示在我的iFrame的左角,但是,我试图显示在中间。请告知如何在以下代码中添加样式:Javascript 如何在document.getElementById()上添加样式,javascript,css,Javascript,Css,我有一个加载程序图像显示在我的iFrame的左角,但是,我试图显示在中间。请告知如何在以下代码中添加样式: var ShowLoader = function() { document.getElementById("mainIframe").style.display = "none"; document.getElementById("documentIframe").src = "http://localhost:63902/images/loading.gif"; }
var ShowLoader = function() {
document.getElementById("mainIframe").style.display = "none";
document.getElementById("documentIframe").src = "http://localhost:63902/images/loading.gif";
}
使用下面的代码居中对齐
document.getElementById("documentIframe").style.textAlign = "center";
document.getElementById("documentIframe").style.margin = "0px auto";
使用
document.getElementById(“mainIframe”).style有什么问题?问题、说明和代码不匹配。style.textAlign=“center”
可能?