遮罩层div
<html> <head> <script src="http://common.cnblogs.com/script/jquery.js" type="text/javascript"></script> <script type="text/javascript"> function ShowDialog() { $('#divGray').css('height', $(document).height()); $('#divGray').show(); $('#divEdit').css('top', $(document).scrollTop() + 80); $('#divEdit').css('left', ($(document).width() - 500) / 2); $('#divEdit').show(); $('#divShadow').css('top', $('#divEdit').offset().top + 5); $('#divShadow').css('left', $('#divEdit').offset().left + 5); $('#divShadow').css('width', $('#divEdit').width()); $('#divShadow').css('height', $('#divEdit').height()); $('#divShadow').show(); } function CancelDialog() { $('#divGray').hide(); $('#divEdit').hide(); $('#divEdit input:text').val(''); $('#divShadow').hide(); } </script> <style type="text/css"> #divEdit { position: absolute; z-index: 10003; width: 480px; border-top: #709cd2 1px solid; border-left: #709cd2 1px solid; border-right: #709cd2 1px solid; border-bottom: #709cd2 1px solid; display: none; } #divGray { position: absolute; z-index: 10001; left: 0px; top: 0px; width: 100%; background-color: #EEEFFF; opacity: 0.6; /* Firefox, Safari(WebKit), Opera) filter: "alpha(opacity=60)"; /* IE 8 */ filter: alpha(opacity=60); /* IE 4-7 */ display: none; } #divShadow { position: absolute; z-index: 10002; background: #000EEE; opacity: 0.1; /* Firefox, Safari(WebKit), Opera) filter: "alpha(opacity=10)"; /* IE 8 */ filter: alpha(opacity=10); /* IE 4-7 */ display: none; } </style> </head> <body> <input type="button" style="height: 30px; width: 100px;" onClick="ShowDialog()" value="cover" /> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <input type="button" value="test" /> <div id="divEdit"> abcd <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <input type="button" value="cancel" onClick="CancelDialog()"/> </div> <div id="divGray"></div><div id="divShadow"></div> </body> </html>
It is ok Html code.
<html> <head> <script src="http://common.cnblogs.com/script/jquery.js" type="text/javascript"></script> <script type="text/javascript"> function ShowDialog() { $('#divGray').css('height', $(document).height()); $('#divGray').show(); $('#divEdit').css('top', $(document).scrollTop() + 200); $('#divEdit').css('left', ($(document).width() - 500) / 2); $('#divEdit').show(); $('#divShadow').css('top', $('#divEdit').offset().top + 5); $('#divShadow').css('left', $('#divEdit').offset().left + 5); $('#divShadow').css('width', $('#divEdit').width()); $('#divShadow').css('height', $('#divEdit').height()); $('#divShadow').show(); } function CancelDialog() { $('#divGray').hide(); $('#divEdit').hide(); $('#divEdit input:text').val(''); $('#divShadow').hide(); } </script> <style type="text/css"> #divEdit { position: absolute; z-index: 10003; width: 480px; background-color: #FFFFF; background: #FFFFF; display: none; } #divGray { position: absolute; z-index: 10001; left: 0px; top: 0px; width: 100%; background-color: #000000; opacity: 0; /* Firefox, Safari(WebKit), Opera) filter: "alpha(opacity=40)"; /* IE 8 */ filter: alpha(opacity=40); /* IE 4-7 */ display: none; } #divShadow { position: absolute; z-index: 10002; background: #FFFFFF; display: none; } </style> </head> <body> <input type="button" style="height: 30px; width: 100px;" onClick="ShowDialog()" value="cover" /> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <input type="button" value="test" /> <div id="divEdit"> abcd <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <input type="button" value="cancel" onClick="CancelDialog()"/> </div> <div id="divGray"></div><div id="divShadow"></div> </body> </html>
相关推荐
cbao 2019-12-29
浪味仙 2019-12-24
Hhjian 2014-05-31
人心 2012-02-05
zhanghao 2016-11-24
攻城师 2019-06-28
asdjkl 2017-05-18
csscode 2016-09-13
海欣海夜 2015-06-29
最近用phonegap在安卓手机中使用Html5+css3做页面,<a name="yes" data-role="button" style="display: block;font-size:16
ruanjianxiong 2014-08-17
83540198 2014-08-01
DevilPace 2014-05-31
Kindlecode 2012-10-27
83510998 2012-04-28
89203856 2012-04-17
83453065 2012-03-14
yyzhu 2011-09-27
ElementW 2011-09-06