JAvascriptポップアップレイヤマスク

1074 ワード

<html>
	<head></head>
	<script src="js/jquery-1.9.1.min.js" type="text/javascript"></script>
	<script type="text/javascript">
		$(function(){
			var width = document.body.clientWidth;
			var height = document.body.clientHeight;
			$("#bg").css({display:"none",width:width,height:height,
				background:"gray",opacity:"0.7",filter:"Alpha(opacity=70)",position:"absolute",top:0,left:0,"zIndex":100});
			$("#dialog").css({display:"none","zIndex":99999,position:"absolute"});
		});
		function show(){
			$("#dialog").show();
			$("#bg").show();
		}
	</script>
	<body>
		<div id="bg"></div>
		<div id="dialog">
			<div id="title">title</div>
			<div id="content">content</div>
		</div>
		<button id="btnClick" onclick="show()">click</button>
	</body>
</html>