首页 > php教程 > php手册 > 正文

自定义弹出对话框

WBOY
发布: 2016-06-06 20:01:03
原创
1150 人浏览过

!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 style type="text/css" *{margin:0;padding:0




    <span>自定义弹出对话框</span>
   

   

 if ( !document.getElementById("SpID"))
 {
     divSp.setAttribute("id", "SpID");
     divSp.style.position="absolute";
     divSp.style.padding="10px";
     divSp.style.width="10px";
     divSp.style.height="10px";
     divSp.style.zIndex="5000";
     divSp.style.top=evnt.clientY+document.body.scrollTop+document.documentElement.scrollTop+"px";
     divSp.style.left=evnt.clientX+document.body.scrollLeft+document.documentElement.scrollLeft+"px";
     divSp.style.border="1px dotted #576999";
     divSp.style.backgroundColor="#E4E7EF";
     divSp.innerHTML="";
     document.body.appendChild(divSp);
     OpenDiv();
 }
 if ( !document.getElementById("SubInfo"))
 {
     btnSub.setAttribute("id", "SubInfo");
     btnSub.type="button";
     btnSub.style.width="50px";
     btnSub.style.position="absolute";
     btnSub.style.top="80%";
     btnSub.style.left="50%";
     btnSub.value="提交";
     btnSub.onclick=function(){
  //document.getElementById("SpIDs").innerHTML=document.getElementById("music").value;
  //CloseDiv();
  document.body.removeChild(divSp);
     };
     document.getElementById("SpID").appendChild(btnSub);
 } 
    }
 function OpenDiv()
 {
 var divopen = document.getElementById("SpID");
  
 if ( divopen.offsetWidth  {
  divopen.style.width=divopen.offsetWidth + 5 + "px";  
 } 
 if ( divopen.offsetHeight 400)
 {
  divopen.style.height=divopen.offsetHeight + 1 + "px";
 }
   
     act=setTimeout("OpenDiv()", 20);
 if(divopen.offsetHeight > 300 && divopen.offsetWidth > 400)
 {
     clearTimeout(act);
 }
 }

 function CloseDiv()
 {
 var divopen = document.getElementById("SpID");
 if ( divopen.offsetWidth >= 0 )
 {
     //divopen.style.width=5 - divopen.offsetWidth + "px";
 } 
 if ( divopen.offsetHeight >= 0 )
 {
     divopen.style.height=divopen.offsetHeight - 2 + "px";
 }
     setTimeout("OpenDiv()", 2);
 }

   



  
 
 

 

 
 

 <script><br /> alert(document.getElementById("btnValue").offsetWidth);<br /> </script>

 窗口
   

来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!