我很擅长html和css,但在Javascript中很糟糕。围绕浮动div的昏暗区域
这是HTML编码我:
<script>
var toggle = function() {
var mydiv = document.getElementById('nodate');
if (mydiv.style.display === 'block' || mydiv.style.display === '')
mydiv.style.display = 'none';
else
mydiv.style.display = 'block'
}
</script>
<div id="nodate" style="display:none"><span class="A"> <input type="image" src="http://www.weebly.com/uploads/1/6/7/6/16768236/custom_themes/307429121386408805/files/close-icon.png?1384992227202" width="42" onclick="toggle();" /></span><b>There are no reservations listed under the date you selected. </b>Please select another date or ask for assistance.<br><br><image src=”http://www.weebly.com/uploads/1/6/7/6/16768236/custom_themes/307429121386408805/files/sorry.jpg?1384992565622” width=”200”/></div>
这个CSS代码随之而来:
#nodate {
background-color: #fff;
width: 95%;
height-min: 300px;
z-index: 500;
border: 2px solid #000;
padding: 10px;
margin-left: auto;
margin-right: auto;
position:absolute;
top: -10px;
left:0;
right:0;
margin-left:auto;
margin-right:auto;
}
.A {
float: right;
margin-top: -30px;
margin-right: -30px;
}
当DIV推出,它涵盖的部分的页面,但我希望它可以调暗它周围的区域。什么是最简单的方法,我该怎么做(如果使用Javascript,请帮我解决)
要变暗页面的其余部分吗 –
创建一个覆盖所有内容的div,然后在其上放置一些东西。 –
你是否在寻找一种模态类型的视图? –