<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xml:lang="zn" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>浮动层居中的对话框效果演示</TITLE>
<META http-equiv=content-type content="application/xhtml+xml; charset=gb2312"><STYLE type=text/css>
BODY {
HEIGHT: 112%
}
BODY {
FONT-SIZE: 9pt; FONT-FAMILY: Tahoma, Verdana, sans-serif
}
DIV.neat-dialog-cont {
Z-INDEX: 8; BACKGROUND: none transparent scroll repeat 0%; LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%
}
DIV.neat-dialog-bg {
Z-INDEX: -1; FILTER: alpha(opacity=80); LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%; BACKGROUND-COLOR: #666; opacity: 0.7
}
DIV.neat-dialog {
BORDER-RIGHT: #444 2px solid; BORDER-TOP: #444 2px solid; Z-INDEX: 99; MARGIN-LEFT: auto; BORDER-LEFT: #444 2px solid; WIDTH: 30%; MARGIN-RIGHT: auto; BORDER-BOTTOM: #444 2px solid; POSITION: relative; TOP: 2%; BACKGROUND-COLOR: #fff
}
DIV.neat-dialog-title {
PADDING-RIGHT: 0.3em; PADDING-LEFT: 0.3em; FONT-SIZE: 0.8em; PADDING-BOTTOM: 0.1em; MARGIN: 0px; LINE-HEIGHT: 0.1em; PADDING-TOP: 0.1em; BORDER-BOTTOM: #444 1px solid; POSITION: relative
}
IMG.nd-cancel {
RIGHT: 0.2em; POSITION: absolute; TOP: 0.2em
}
DIV.neat-dialog P {
PADDING-RIGHT: 0.2em; PADDING-LEFT: 0.2em; PADDING-BOTTOM: 0.2em; PADDING-TOP: 0.2em; TEXT-ALIGN: left
}</STYLE><SCRIPT type=text/javascript>
function NeatDialog(sHTML, sTitle, bCancel)
{
window.neatDialog = null;
this.elt = null;
if (document.createElement && document.getElementById)
{
var dg = document.createElement("div");
dg.className = "neat-dialog";
if (sTitle)
sHTML = '<div class="neat-dialog-title">'+sTitle+sHTML;
dg.innerHTML = sHTML; var dbg = document.createElement("div");
dbg.id = "nd-bdg";
dbg.className = "neat-dialog-bg"; var dgc = document.createElement("div");
dgc.className = "neat-dialog-cont";
dgc.appendChild(dbg);
dgc.appendChild(dg); //adjust positioning if body has a margin
if (document.body.offsetLeft > 0)
dgc.style.marginLeft = document.body.offsetLeft + "px"; document.body.appendChild(dgc);
if (bCancel) document.getElementById("nd-cancel").onclick = function()
{
window.neatDialog.close();
};
this.elt = dgc;
window.neatDialog = this;
}
}
NeatDialog.prototype.close = function()
{
if (this.elt)
{
this.elt.style.display = "none";
this.elt.parentNode.removeChild(this.elt);
}
window.neatDialog = null;
}function openDialog()
{var sHTML = " <table width='700' cellspacing='0'>"
+ " <tr><td color='#000000' colspan='6' align='right'><a onclick='javascript:window.neatDialog.close()'><img src='image/chacha.jpg'></a></td></tr>"
+"<tr class='even'>"
+"<td width='55'><strong>拍摄套系 </strong></td>"
+"<td width='155'><strong>A</strong></td>"
+"<td width='155'><strong>B</strong></td>"
+"<td width='250'><strong>C</strong></td>"
+"<td width='200'><strong>D</strong></td>"
+"<td width='149'><strong>E</strong></td>"
+"</tr></table>";
new NeatDialog(sHTML, "", false);
}
</SCRIPT>
<META content="MSHTML 6.00.3790.630" name=GENERATOR></HEAD>
<body bgcolor="#FFFFff" leftMargin=0 topMargin=0 id="specs">
<BUTTON onclick=openDialog()>演示层提示效果</BUTTON>
</BODY></HTML>
<HTML xml:lang="zn" xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>浮动层居中的对话框效果演示</TITLE>
<META http-equiv=content-type content="application/xhtml+xml; charset=gb2312"><STYLE type=text/css>
BODY {
HEIGHT: 112%
}
BODY {
FONT-SIZE: 9pt; FONT-FAMILY: Tahoma, Verdana, sans-serif
}
DIV.neat-dialog-cont {
Z-INDEX: 8; BACKGROUND: none transparent scroll repeat 0%; LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%
}
DIV.neat-dialog-bg {
Z-INDEX: -1; FILTER: alpha(opacity=80); LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%; BACKGROUND-COLOR: #666; opacity: 0.7
}
DIV.neat-dialog {
BORDER-RIGHT: #444 2px solid; BORDER-TOP: #444 2px solid; Z-INDEX: 99; MARGIN-LEFT: auto; BORDER-LEFT: #444 2px solid; WIDTH: 30%; MARGIN-RIGHT: auto; BORDER-BOTTOM: #444 2px solid; POSITION: relative; TOP: 2%; BACKGROUND-COLOR: #fff
}
DIV.neat-dialog-title {
PADDING-RIGHT: 0.3em; PADDING-LEFT: 0.3em; FONT-SIZE: 0.8em; PADDING-BOTTOM: 0.1em; MARGIN: 0px; LINE-HEIGHT: 0.1em; PADDING-TOP: 0.1em; BORDER-BOTTOM: #444 1px solid; POSITION: relative
}
IMG.nd-cancel {
RIGHT: 0.2em; POSITION: absolute; TOP: 0.2em
}
DIV.neat-dialog P {
PADDING-RIGHT: 0.2em; PADDING-LEFT: 0.2em; PADDING-BOTTOM: 0.2em; PADDING-TOP: 0.2em; TEXT-ALIGN: left
}</STYLE><SCRIPT type=text/javascript>
function NeatDialog(sHTML, sTitle, bCancel)
{
window.neatDialog = null;
this.elt = null;
if (document.createElement && document.getElementById)
{
var dg = document.createElement("div");
dg.className = "neat-dialog";
if (sTitle)
sHTML = '<div class="neat-dialog-title">'+sTitle+sHTML;
dg.innerHTML = sHTML; var dbg = document.createElement("div");
dbg.id = "nd-bdg";
dbg.className = "neat-dialog-bg"; var dgc = document.createElement("div");
dgc.className = "neat-dialog-cont";
dgc.appendChild(dbg);
dgc.appendChild(dg); //adjust positioning if body has a margin
if (document.body.offsetLeft > 0)
dgc.style.marginLeft = document.body.offsetLeft + "px"; document.body.appendChild(dgc);
if (bCancel) document.getElementById("nd-cancel").onclick = function()
{
window.neatDialog.close();
};
this.elt = dgc;
window.neatDialog = this;
}
}
NeatDialog.prototype.close = function()
{
if (this.elt)
{
this.elt.style.display = "none";
this.elt.parentNode.removeChild(this.elt);
}
window.neatDialog = null;
}function openDialog()
{var sHTML = " <table width='700' cellspacing='0'>"
+ " <tr><td color='#000000' colspan='6' align='right'><a onclick='javascript:window.neatDialog.close()'><img src='image/chacha.jpg'></a></td></tr>"
+"<tr class='even'>"
+"<td width='55'><strong>拍摄套系 </strong></td>"
+"<td width='155'><strong>A</strong></td>"
+"<td width='155'><strong>B</strong></td>"
+"<td width='250'><strong>C</strong></td>"
+"<td width='200'><strong>D</strong></td>"
+"<td width='149'><strong>E</strong></td>"
+"</tr></table>";
new NeatDialog(sHTML, "", false);
}
</SCRIPT>
<META content="MSHTML 6.00.3790.630" name=GENERATOR></HEAD>
<body bgcolor="#FFFFff" leftMargin=0 topMargin=0 id="specs">
<BUTTON onclick=openDialog()>演示层提示效果</BUTTON>
</BODY></HTML>
解决方案 »
- option的click事件在ie下无效怎么办?
- jqurey treeview在asp.net里如何将后台sqlserver的数据在页面加载时就动态绑定并显示
- 向大家请教一个关于JS弹出模式层的问题
- jquery 新手一问
- 求助:动态加载自定义控件,javascript脚本无法执行。
- 谁能帮我解释一下这段javascript代码
- moo.fx.pack.js 的疑惑
- 链接与图片的问题
- 浏览器安全级别换成中或者高就不执行JS脚本 急!!!!
- 关于输入限制的问题!
- 在网页中打开PDF时,如何用Javascript屏蔽Adobe Acrobat Reader的热键
- 急!如何动态改变iframe的src值?
一会还要出一个叫做ie8的怪胎.有的搞了.我们的项目要支持ie5-7,ff2-3,oper六个浏览器,可惜我没有SVN源代码,不能搞来给LZ了.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<style type="text/css">
body {
text-align: center;
min-width: 760px;
}
#wrapper {
width: 720px;
margin: 0 auto;
text-align: center;
}
</style>
</head>
<body>
<div id="wrapper">
<h1>天龍八部</h1>
<ul>
<li>
第一部
</li>
<li>
第二部
</li>
</ul>
</div>
</body>
</html>
试试这段代码返回一个长度为四的数组{页面宽,页面高,窗口宽,窗口高}
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;//返回一个长度为四的数组{页面宽,页面高,窗口宽,窗口高}
}