WEB页面右下角弹出窗口在项目中的应用



<style type="text/css">
#winpop { width:120px; height:0px; position:absolute; right:0; bottom:0; border:1px solid #999999; margin:0; padding:1px; overflow:hidden; display:none; background:#FFFFFF}
#winpop .title { width:100%; height:20px; line-height:20px; background:#FFCC00; font-weight:bold; text-align:center; font-size:12px;}
#winpop .con { width:100%; height:80px; line-height:80px; font-weight:bold; font-size:12px; color:#FF0000; text-decoration:underline; text-align:left;background:#FFF8DC}
.close { position:absolute; right:4px; top:-1px; color:#FF3333; cursor:pointer}
</style>



<script type="text/javascript">
//如果是从数据库中抓符合条件记录来显示
//则将方法tips_pop()方法中传个值就可以了
//function tips_pop(value){
var hide;
function tips_pop(){
// var orders=value; 这样取的值value就是从数据库中抓出来的值
var orders='O2008090731;O2008090732;O2008090733;O2008090734;O2008090735;O2008090736';
view(orders);
var MsgPop=document.getElementById("winpop");//获取窗口这个对象,即ID为winpop的对象
var popH=parseInt(MsgPop.style.height);//用parseInt将对象的高度转化为数字,以方便下面比较
if (popH==0){//如果窗口的高度是0
MsgPop.style.display="block";//那么将隐藏的窗口显示出来
hide=setInterval("changeH('up')",2);//开始以每0.002秒调用函数changeH("up"),即每0.002秒向上移动一次
}
else {//否则
hide=setInterval("changeH('down')",2);//开始以每0.002秒调用函数changeH("down"),即每0.002秒向下移动一次
}
}
function changeH(str)
{

var MsgPop=document.getElementById("winpop");
var popH=parseInt(MsgPop.style.height);
if(str=="up"){//如果这个参数是UP
if (popH<=160){//如果转化为数值的高度小于等于100
MsgPop.style.height=(popH+8).toString()+"px";//高度增加4个象素
}
else{
clearInterval(hide);//否则就取消这个函数调用,意思就是如果高度超过160象度了,就不再增长了
}
}
if(str=="down"){
if (popH>=8)
{//如果这个参数是down
MsgPop.style.height=(popH-8).toString()+"px";//那么窗口的高度减少4个象素
}
else{//否则
clearInterval(hide);//否则就取消这个函数调用,意思就是如果高度小于4个象度的时候,就不再减了
MsgPop.style.display="none";//因为窗口有边框,所以还是可以看见1~2象素没缩进去,这时候就把DIV隐藏掉
}
}
}
window.οnlοad=function()
{//加载
document.getElementById('winpop').style.height='0px';
setTimeout("tips_pop()",800);//3秒后调用tips_pop()这个函数 setInterval
}


function view(s) {
arry = s.split(";");
var str = "";

for(i=0;i<arry.length;i++) {
str = str+"<tr><td><font size=2><a href='/项目名/noresolvedorder.do?method=noresolved&order_no="+arry[i]+"'>"+arry[i]+"</a></font></td></tr>";
}
document.all.myorder.innerHTML = "<table><tr><td><font size=2>未处理订单</font></td></tr>"+str+"</table>";
}

</script>

</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<span οnclick="tips_pop()" style="cursor:hand">查看信息</span>
<div id="winpop">
<div class="title">温馨提示<span class="close" οnclick="tips_pop()">X</span></div>
<!-- <div class="con">未读信息(1)</div> -->
<div id="myorder" class="con">点击这里查看详细</div>
</div>
</body>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章