<script>
var timer
var Opacity = 0
function hide() {
oDiv.style.display = "block"
oDiv.style.height = document.body.scrollHeight
Opacity = 0
event.srcElement.blur()
timer = window.setInterval("aa()", 5)
}function aa()
{
if (Opacity == 50)
{
window.clearInterval(timer)
oButton.style.display = "block"
return
}
Opacity = ( Opacity + 3 ) > 50 ? 50 : Opacity + 3
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}function bb()
{
if (Opacity == 0)
{
window.clearInterval(timer)
oDiv.style.display = "none"
return
}
Opacity = (Opacity - 3 < 0) ? 0 : Opacity - 3
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}function cc()
{
timer = window.setInterval('bb()', 5);
oButton.style.display='none';
}
</script>
<body topmargin=0 leftmargin=0>
<div id=oDiv style="position:absolute;z-index:99; background-color:darkgray; Filter: Alpha(Opacity=0); border:1px solid #333333;display:none;width:100%;vertical-align:center;text-align:center"> </div>
<button onclick=hide()>hide</button>
<button id=oButton style="position:absolute; left:100;top:200;z-index:100;display:none" onclick="cc()">确定</button>
<script>
for (var i=0; i<30; i++)
document.write ("<p>123</p>")
</script>
别人写的。。
var timer
var Opacity = 0
function hide() {
oDiv.style.display = "block"
oDiv.style.height = document.body.scrollHeight
Opacity = 0
event.srcElement.blur()
timer = window.setInterval("aa()", 5)
}function aa()
{
if (Opacity == 50)
{
window.clearInterval(timer)
oButton.style.display = "block"
return
}
Opacity = ( Opacity + 3 ) > 50 ? 50 : Opacity + 3
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}function bb()
{
if (Opacity == 0)
{
window.clearInterval(timer)
oDiv.style.display = "none"
return
}
Opacity = (Opacity - 3 < 0) ? 0 : Opacity - 3
oDiv.style.filter = "Alpha(Opacity=" + Opacity + ")"
}function cc()
{
timer = window.setInterval('bb()', 5);
oButton.style.display='none';
}
</script>
<body topmargin=0 leftmargin=0>
<div id=oDiv style="position:absolute;z-index:99; background-color:darkgray; Filter: Alpha(Opacity=0); border:1px solid #333333;display:none;width:100%;vertical-align:center;text-align:center"> </div>
<button onclick=hide()>hide</button>
<button id=oButton style="position:absolute; left:100;top:200;z-index:100;display:none" onclick="cc()">确定</button>
<script>
for (var i=0; i<30; i++)
document.write ("<p>123</p>")
</script>
别人写的。。
如果是FF,也是一个层,不过是用透明的PNG做背景图;
无边框的框,还是一个DIV,浮在最上面
<script src="popAlert.js" language="javascript"></script>
<script>
function clk_yes(){
alert("yes");
}
function clk_no(){
alert("no");
}</script>
<body>
<button onClick="showAlert('今天天气真好呀')">test</button>
<button onClick="showConfirm('确定么?','clk_yes','clk_no')">询问框测试</button><p</body>
//<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
/**
* 功能:显示提示窗口
* 作者:申楠 qq:38371354 email:[email protected] http;//amushen.cnblogs.com
* 日期:2005-10-26
* 版本:1.1
* 备注:版权没有,随便拷贝,如果用于商业应用请通知本人,同时保留这段注释。
*
*/ /**
* 描述:显示提示层
* 作者:申楠
* 参数: 显示信息内容
* 返回: 无
* 日期:2005-10-25
*/
var ifm=null;
function showAlert(info){
var pBody;
pBody=init();
initAlertBody(pBody,info);
pBody.focus();
}
function showConfirm(info,_yes,_no){
var pBody;
pBody=init();
initConfirmBody(pBody,info,_yes,_no);
pBody.focus();
}
/**
* 描述:初始基本信息
* 作者:申楠
* 参数: 无
* 返回: 内容层
* 日期:2005-10-25
*/ function init(){
if(ifm==null){
ifm=document.createElement("<iframe allowTransparency='true' id='popframe' frameborder=0 marginheight=0 src='about:blank' marginwidth=0 hspace=0 vspace=0 scrolling=no></iframe>")
ifm.style.position="absolute";
document.body.appendChild(ifm);
}else{
ifm.style.visibility="visible";
}
ifm.style.width=screen.availWidth;
ifm.style.height=screen.availHeight;
ifm.style.left=document.body.scrollLeft;
ifm.style.top=document.body.scrollTop;
ifm.name=ifm.uniqueID;
var win=window.frames[ifm.name];
win.document.write("<body leftmargin=0 topmargin=0 oncontextmenu='self.event.returnValue=false'><div id=popbg></div><div id=popbody></div><div></div></body>");
win.document.body.style.backgroundColor="transparent";
document.body.style.overflow="hidden";
var pBody=win.document.body.children[1];
var pBg=win.document.body.children[0];
var pSnd=win.document.body.children[2];
hideAllSelect();
initSnd(pSnd);
initBg(pBg);
return pBody;
}
/**
* 描述:初始音效
* 作者:申楠
* 参数: obj;音效层
* 返回: 无
* 日期:2005-10-25
*/
function initSnd(obj){
obj.innerHTML='<embed src="snd.mp3" loop="false" autostart="true" hidden=true></embed>';
}
/**
* 描述:初始化背景层
* 作者:申楠
* 参数: obj;背景层
* 返回: 无
* 日期:2005-10-25
*/
function initBg(obj){
with(obj.style){
position="absolute";
left="0";
top="0";
width="100%";
height="100%";
visibility="hidden";
backgroundColor="#333333";
filter="blendTrans(duration=1) alpha(opacity=60)";
}
if (obj.filters.blendTrans.status != 2) {//no playing
obj.filters.blendTrans.apply();
obj.style.visibility="visible";
obj.filters.blendTrans.play();
}
}
/**
* 描述:初始化显示层
* 作者:申楠
* 参数: obj;显示层;info:显示内容;
* 返回: 无
* 日期:2005-10-25
*/
function initAlertBody(obj,info){
with(obj.style){
position="absolute";
width="400";
height="150";
backgroundColor="#ffffff";
}
obj.style.left=window.document.body.clientWidth/2-200;
obj.style.top=window.document.body.clientHeight/3;
var str;
str="<table border=0 cellpadding=0 cellspacing=1 bgcolor=#000000 width=100% height=100%><tr height=30>";
str+="<td align=left style='color:#000000;font-size:14px;font-weight:bold' bgcolor=#9999ff>[提示]</td></tr>";
str+="<tr><td align=center bgcolor=#efefff style='font-size:12px;color:#000000;vertical-align: middle;'>";
str+=info+"</td></tr><tr height=30 bgcolor=#efefef><td align=center><button onclick='parent.closeWin()' style='border:solid 1px #666666;background:#cccccc'>确定</button></td></tr></table>";
obj.innerHTML=str;
} /**
* 描述:初始化显示层 conFirm提示层
* 作者:申楠
* 参数: obj;显示层;info:显示内容;_yes:click ok to trig;_no:click no to trig
* 返回: 无
* 日期:2005-10-25
*/
function initConfirmBody(obj,info,_yes,_no){
with(obj.style){
position="absolute";
width="400";
height="150";
backgroundColor="#ffffff";
}
obj.style.left=window.document.body.clientWidth/2-200;
obj.style.top=window.document.body.clientHeight/3;
var str;
str="<table border=0 cellpadding=0 cellspacing=1 bgcolor=#000000 width=100% height=100%><tr height=30>";
str+="<td align=left style='color:#000000;font-size:14px;font-weight:bold' bgcolor=#9999ff>[询问]</td></tr>";
str+="<tr><td align=center bgcolor=#efefff style='font-size:12px;color:#000000;vertical-align: middle;'>";
str+=info+"</td></tr><tr height=30 bgcolor=#efefef><td align=center><button style='width:40px' onclick='parent.closeWin();parent."+_yes+"();' style='border:solid 1px #666666;background:#cccccc'>是</button> <button style='width:40px' onclick='parent.closeWin();parent."+_no+"();' style='border:solid 1px #666666;background:#cccccc'>否</button></td></tr></table>";
obj.innerHTML=str;
} /**
* 描述:关闭一切
* 作者:申楠
* 参数: obj :the iframe 's name
* 返回: 无
* 日期:2005-10-25
*/
function closeWin(){
ifm.style.visibility="hidden";
showAllSelect();
document.body.style.overflow="auto";
}
/**
* describe:hide all select
* author:shennan
* params:
* return:
* date:2005-10-25
*/
function hideAllSelect(){
var obj;
obj=document.getElementsByTagName("SELECT");
var i;
for(i=0;i<obj.length;i++)
obj[i].style.visibility="hidden";
}
function showAllSelect(){
var obj;
obj=document.getElementsByTagName("SELECT");
var i;
for(i=0;i<obj.length;i++)
obj[i].style.visibility="visible";
}