頁面右下角彈出提示框示例代碼js版
更新時(shí)間:2013年08月02日 17:26:59 投稿:whsnow
右下角彈出提示框想必大家不會陌生吧,本文簡單的為大家實(shí)現(xiàn)一個(gè),具體代碼如下,有需求的朋友可以參考下
復(fù)制代碼 代碼如下:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!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=gb2312" />
<title>無標(biāo)題文檔</title>
<style type="text/css">
* {margin:0px;padding:0px;}
html,body { height:100%;}
body { font-size:14px; line-height:24px;}
#tip {
position: absolute;
right: 0px;
bottom: 0px;
height: 0px;
width: 180px;
border: 1px solid #CCCCCC;
background-color: #eeeeee;
padding: 1px;
overflow:hidden;
display:none;
font-size:12px;
z-index:10;
}
#tip p { padding:6px;}
#tip h1,#detail h1 {
font-size:14px;
height:25px;
line-height:25px;
background-color:#0066CC;
color:#FFFFFF;
padding:0px 3px 0px 3px;
filter: Alpha(Opacity=100);
}
#tip h1 a,#detail h1 a {
float:right;
text-decoration:none;
color:#FFFFFF;
}
#shadow {
position:absolute;
width:100%;
height:100%;
background-color:#000000;
z-index:11;
filter: Alpha(Opacity=70);
display:none;
overflow:hidden;
}
#detail {
width:500px;
height:200px;
border:3px double #ccc;
background-color:#FFFFFF;
position:absolute;
z-index:30;
display:none;
left:30%;
top:30%
}
</style>
<script type="text/javascript">
var handle;
function start()
{
var obj = document.getElementById("tip");
if (parseInt(obj.style.height)==0)
{ obj.style.display="block";
handle = setInterval("changeH('up')",2);
}else
{
handle = setInterval("changeH('down')",2)
}
}
function changeH(str)
{
var obj = document.getElementById("tip");
if(str=="up")
{
if (parseInt(obj.style.height)>200)
clearInterval(handle);
else
obj.style.height=(parseInt(obj.style.height)+8).toString()+"px";
}
if(str=="down")
{
if (parseInt(obj.style.height)<8)
{ clearInterval(handle);
obj.style.display="none";
}
else
obj.style.height=(parseInt(obj.style.height)-8).toString()+"px";
}
}
function showwin()
{
document.getElementsByTagName("html")[0].style.overflow = "hidden";
start();
document.getElementById("shadow").style.display="block";
document.getElementById("detail").style.display="block";
}
function recover()
{
document.getElementsByTagName("html")[0].style.overflow = "auto";
document.getElementById("shadow").style.display="none";
document.getElementById("detail").style.display="none";
}
</script>
</head>
<body onload="document.getElementById('tip').style.height='0px'">
<div id="shadow"> </div>
<div id="detail">
</div>
</body>
</html>
<script language="JavaScript">
window.attachEvent("onload", myTimer); //綁定到onload事件
function myTimer() {
start();
window.setTimeout("myTimer()",6000);//設(shè)置循環(huán)時(shí)間
}
</script>
相關(guān)文章
JS定時(shí)器用法分析【時(shí)鐘與菜單中的應(yīng)用】
這篇文章主要介紹了JS定時(shí)器用法,結(jié)合時(shí)鐘與菜單中的應(yīng)用分析了JS中setInterval與setTimeout操作時(shí)間的相關(guān)技巧,需要的朋友可以參考下2016-12-12js 判斷字符串中是否包含某個(gè)字符串的實(shí)現(xiàn)代碼
工作中經(jīng)常會使用到判斷一個(gè)字符串是否包含某一個(gè)字符串,因此總結(jié)一下幾個(gè)方法,需要的朋友可以參考下2023-03-03JavaScript實(shí)現(xiàn)同時(shí)調(diào)用多個(gè)函數(shù)的方法
這篇文章主要介紹了JavaScript實(shí)現(xiàn)同時(shí)調(diào)用多個(gè)函數(shù)的方法,以一個(gè)簡單實(shí)例分析了JavaScript同時(shí)調(diào)用兩個(gè)函數(shù)的實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11JavaScript學(xué)習(xí)筆記整理之引用類型
引用類型是JavaScript中很重要的內(nèi)容,通過本文給大家介紹JavaScript學(xué)習(xí)筆記整理之引用類型,對js引用類型相關(guān)知識感興趣的朋友一起學(xué)習(xí)吧2016-01-01