当前位置: 代码迷 >> JavaScript >> js遮罩有关问题
  详细解决方案

js遮罩有关问题

热度:109   发布时间:2012-11-22 00:16:41.0
js遮罩问题
/* loading  */
#loading{
	width: 50%;
	height: 50%;
	top:25%;
    left:25%;
    line-height:70px;
	background-color:#CCCCFF;
	text-align:center;
	border:1px #6A5ACD  solid;
    position: absolute;
    z-index: 4999;
    font-size:12px;
}

#loading_gif{
	float: right;
    z-index: 7999;
    padding: 5px 0 0 0;
}
#loginTitle {   
   float:left;   
   font-size: 14px;
   color:#00008B;
   padding: 5px 0 0 0;   
} 
#loginTitleBar {   
    background-color: #6885ba;   
    color: #ffffff;    
    height: 3.5mm;   
    padding: 5px;   
    border-bottom: 1px solid #0088A8;   
    border-top: 1px solid #0088A8 ;   
    border-left: 1px solid #0088A8 ;   
    border-right: 1px solid #0088A8 ;   
    position: relative;   
    z-index: 6999;   
} 
#shadow{
    position:absolute;
    left:0;
    top:0;
    width:100%;
    height:100%;
    background:#cccccc;
    z-index:3999;
    filter:alpha(opacity=70);
    opacity:0.7;
 }


Login.getElementID = function $(id){ 
    return document.getElementById(id);
  };
Login.showDialog = function(){
    var shadow = document.createElement("div");            
    var loading = document.createElement("div");                
    shadow.setAttribute("id", "shadow");        
    loading.setAttribute("id", "loading"); 
    loading.innerHTML="<div id='loginTitleBar'>" + "<div id='loginTitle'><label for='searchTips_lab'>" + "searching...</label>" +"</div>"+"<div id='loading_gif'>" + "<img src='img/loading.gif'/>" + "</div></div>";
    // Create button
    var button = document.createElement("input");
    button.setAttribute("id", "cancel_button");
    button.setAttribute("type", "button");
    button.setAttribute("value", "Cancel");
    loading.appendChild(button);
    
    var container = Login.getElementID("container");   
    container.appendChild(shadow);
    container.appendChild(loading);
    labelID = Login.getElementID("cancel_button");
    Login.cancel();
  };
Login.hideDialog = function(){
    var container = Login.getElementID("container");
    var shadow = Login.getElementID("shadow");
    var loading = Login.getElementID("loading");
    container.removeChild(shadow);
    container.removeChild(loading);
	};
Login.cancel = function(req){
    var cancel =Login.getElementID("cancel_button");
    cancel.onclick = function() {
    	Logino.hideDialog();	
    }
}; 
以上代码执行后的界面是以下附件,但是 我想文字和loading图片显示在标题上,但显示不了。是什么问题?

?

  相关解决方案