DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> javascript jq 彈出層實例
javascript jq 彈出層實例
編輯:關於JavaScript     
復制代碼 代碼如下:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery彈出層實例</title>
<script type="text/javascript" src="http://www.jqueryajax.com/wp-content/uploads/2009/03/jquery-132min1.js"></script>
<script type="text/javascript">
$(function(){
$(".but").click(function(){
var str = "這裡是信息內容,這裡是信息內容!";
$(".form").html(str);
$("#faqbg").css({display:"block",height:$(document).height()});
var yscroll =document.documentElement.scrollTop;
$("#faqdiv").css("top","100px");
$("#faqdiv").css("display","block");
document.documentElement.scrollTop=0;
});
$(".close").click(function(){
$("#faqbg").css("display","none");
$("#faqdiv").css("display","none");
});
})
</script>
<style type="text/css">
body,h2{margin:0 ; padding:0;}
#faqbg{background-color:#666666; position:absolute; z-index:99; left:0; top:0; display:none; width:100%; height:1000px;opacity:0.5;filter: alpha(opacity=50);-moz-opacity: 0.5;}
#faqdiv{position:absolute;width:400px; left:50%; top:50%; margin-left:-200px; height:auto; z-index:100;background-color:#fff; border:1px #8FA4F5 solid; padding:1px;}
#faqdiv h2{ height:25px; font-size:14px; background-color:#8FA4F5; position:relative; padding-left:10px; line-height:25px;}
#faqdiv h2 a{position:absolute; right:5px; font-size:12px; color:#FF0000}
#faqdiv .form{padding:10px;}
</style>
</head>

<body >

<div id="faqbg"></div>
<div id="faqdiv" style="display:none">
<h2>信息窗口<a href="#" class="close">關閉</a></h2>
<div class="form">
這裡是提示信息!!

</div>
</div>
<p align="center">
<input value="彈出" class="but" type="button" />
<input type="button" value="關閉" class="close" />
</p>
</body>
</html>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved