復制代碼 代碼如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title> New Document </title>
<script type="text/javascript" src="../jquery-1.7.2.js"></script>
<script type="text/javascript">
//創建一個彈出層,title 標題,width 寬度,height 高度,content 內容,url 如果url不為空時則覆蓋content加載url頁面中的內容
function CreatePopLayerDiv(title,width,height,content,url){
var titles = title || "標題";
var Iheight=$(window).height();
var Iwidth =$(window).width();
var heights = height || 300;
var widths = width || 500;
var Oheight= (Iheight -heights) / 2;
var Owidth = (Iwidth - widths) /2;
var contents = content || "內容";
var div = "<div><div><h4>"+titles+"<a>關閉</a></h4><div>"+contents+"</div></div></div>";
$(document.body).append(div);
if(url != ""){
$("#Content").load(url);
}
}
//移除彈出層
function RemoveDiv(){
$("#AClose").remove();
$("#HTitle").remove();
$("#offDiv").remove();
$("#InDiv").remove();
}
$(function(){
$("#btnTCC").click(function(){
CreatePopLayerDiv("閃耀的瞬間",600,400,"彈出層","table偶數行變色.html");
});
})
function btnCloses(){
RemoveDiv();
}
</script>
</head>
<body>
<input type="button" value="彈出層" />
</body>
</html>
新聞熱點
疑難解答
圖片精選