日期:2014-05-16  浏览次数:20417 次

遮罩层拖动问题
HTML code
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>测试 </title>
<script type="text/javascript">
function popup(str,popWidth,popHeight){
    var titleDivHeight=15;
    var contentDivHeight=popHeight-20;
    var borderColor="#6699cc";
    var titleDivColor="#709CD2";
    var maskDivWidth=document.body.offsetWidth;
    var maskDivHeight=screen.height;
    var maskDiv=document.createElement("div");
    maskDiv.setAttribute('id','maskDiv');
    maskDiv.style.position="absolute";
    maskDiv.style.background="#f2f2f2";
    maskDiv.style.top="0";
    maskDiv.style.left="0";
    maskDiv.style.width="100%";
    maskDiv.style.height=maskDivHeight + "px";
    maskDiv.style.zIndex = "10000";
    document.body.appendChild(maskDiv);
    var containerDiv=document.createElement("div");
    containerDiv.setAttribute("id","containerDiv");
    containerDiv.setAttribute("align","center");
    containerDiv.style.background="white";
    containerDiv.style.border="1px solid " + borderColor;
    containerDiv.style.position = "absolute";
    containerDiv.style.left = parseInt((document.body.offsetWidth-popWidth)/2)+"px";
    containerDiv.style.top = parseInt((document.body.offsetHeight-popHeight)/2)+10+"px";
    containerDiv.style.font="12px Arial";
    containerDiv.style.width = popWidth + "px";
    containerDiv.style.height =popHeight + "px";
    containerDiv.style.zIndex = "10001";
    document.body.appendChild(containerDiv);
    var titleDiv=document.createElement("div");
    titleDiv.setAttribute("id","titleDiv");
    titleDiv.setAttribute("align","right");
    titleDiv.style.margin="0";
    titleDiv.style.padding="4px 0";
    titleDiv.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
    titleDiv.style.opacity="65%";
    titleDiv.style.background=titleDivColor;
    titleDiv.style.border="1px solid " + borderColor;
    titleDiv.style.height=titleDivHeight+"px";
    titleDiv.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
    titleDiv.style.color="white";
    titleDiv.style.cursor="move";
    var beginMoving=false;
    /*----------------------------------问题所在------------------------------------------*/
    titleDiv.onmousedown=function(e){
                                        beginMoving=true;
                        &nbs