JS弹出一个层处理提交

   <script type="text/javascript">
          function $(elem){
             return document.getElementById(elem);
         }
         function Login(isbackDiv){
          if($('floatDiv')==null){
           var floatDiv = document.createElement('div');
           floatDiv.id = "floatDiv";
           floatDiv.style.position = "absolute";
           floatDiv.style.width = 300 + "px";
           floatDiv.style.height = 200 + "px";
           floatDiv.style.left =(document.documentElement.clientWidth/2 + document.documentElement.scrollLeft - 150)+"px";
           floatDiv.style.top =(document.documentElement.clientHeight/2 + document.documentElement.scrollTop - 100)+"px";
           floatDiv.style.zIndex  = 1001;
           var loginText = "<iframe id=\"iframe1\" frameborder=\"0\" scrolling=\"no\" src=\"login.aspx\" width=\"100%\" height=\"200\"></iframe>";
           floatDiv.innerHTML = loginText;
           document.body.appendChild(floatDiv);
          }
          else{
           $('floatDiv').style.display = "block";
          }
          if($('backDiv')==null && isbackDiv ==true){
           var backDiv = document.createElement('div');
           backDiv.id = "backDiv";
           backDiv.style.backgroundColor = "Black";
           backDiv.style.filter = "alpha(opacity=70)";
           backDiv.style.MozOpacity = "0.70";
           backDiv.style.position = "absolute";
           backDiv.style.left = "0px";
           backDiv.style.top = "0px";
           backDiv.style.width = Math.max(document.body.scrollWidth, document.documentElement.clientWidth) +"px";
           backDiv.style.height = Math.max(document.body.scrollHeight, document.documentElement.clientHeight)+"px";
           document.body.appendChild(backDiv);
           $('backDiv').style.zIndex = 1000;
          }
          else if(isbackDiv ==true){
           $('backDiv').style.display = "block";
          } 
         }
         function moveDiv(event, elem)
         {
          $('floatDiv').style.filter = "alpha(opacity=50)";
          var oObj = $(elem);
          oObj.onmousemove = mousemove;
          oObj.onmouseup = mouseup;
          oObj.setCapture ? oObj.setCapture() : function(){};
          oEvent = window.event ? window.event : event;
          var dragData = {x : oEvent.clientX, y : oEvent.clientY};
          var backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)};
          function mousemove()
          {
           var oEvent = window.event ? window.event : event;
           var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left);
           var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top);
           oObj.style.left = iLeft;
           oObj.style.top = iTop;
           dragData = {x: oEvent.clientX, y: oEvent.clientY};
          }
          function mouseup()
          {
           var oEvent = window.event ? window.event : event;
           oObj.onmousemove = null;
           oObj.onmouseup = null;
           $('floatDiv').style.filter = "";
           if(oEvent.clientX < 1 || oEvent.clientY < 1)
           {
            oObj.style.left = backData.y;
            oObj.style.top = backData.x;
           }
            oObj.releaseCapture ? oObj.releaseCapture() : function(){};
          }
         }
         function CloseFloatDiv(){
          $('floatDiv').style.display = "none";
          if($('backDiv')){
           $('backDiv').style.display = "none";
          }
         }
    </script>
posted @ 2009-03-18 16:30  melody&amp;amp;amp;bobo  阅读(439)  评论(2编辑  收藏  举报