自动弹出窗口,并定时关闭

 弹出的消息代码:

      <SCRIPT language=JavaScript src="js/popup.js"></SCRIPT>
      <DIV id=windlocation style="LEFT: 50px; VISIBILITY: hidden; WIDTH: 1px; POSITION: absolute; TOP: 100px; HEIGHT: 1px">
      <TABLE style="BORDER-RIGHT: 1px outset; BORDER-TOP: 1px outset; BORDER-LEFT: 1px outset; BORDER-BOTTOM: 1px outset"height=220 width=300 bgColor=#FFF9EE>
        <TBODY>
        <TR>
          <TD>
            <TABLE class=f_one style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset" height=200 width=280 align=center bgColor=#ffffff>
              <TBODY>
              <TR>
                <TD vAlign=center align=middle><BR><BR><img src="images/iconMailBlue_16x16.gif" width="16" height="16"> <strong><span style="font-size:13px;">您有新的消息请注意查收</span><BR><BR>
    <a href="msg_receive.asp"><strong>您有 <font color="#FF0000"><%=msgtotal%></font> 条留言</strong></a> </strong>
                  <P>(此视窗将于 5 秒后自动关闭)
      </P></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
   </DIV>

 

popup.js 包含的JS文件

timePopup=5;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
adCount=0;
function initPopup(){
 if(!ns && !ie && !w3){
  return;
 }
 if(ie){
  adDiv=eval('document.all.windlocation.style');
 }else if(ns){
  adDiv=eval('document.layers["windlocation"]');
 }else if(w3){
  adDiv=eval('document.getElementById("windlocation").style');
 }
 if (ie||w3){
  adDiv.visibility="visible";
 }else{
  adDiv.visibility ="show";
 }
 showPopup();
}
function showPopup(){
 if(adCount<timePopup*10){
  adCount+=1;
  if (ie){
   documentWidth  =document.body.offsetWidth/2+document.body.scrollLeft-20;
   documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;
  } else if (ns){
   documentWidth=window.innerWidth/2+window.pageXOffset-20;
   documentHeight=window.innerHeight/2+window.pageYOffset-20;
  } else if (w3){
   documentWidth=self.innerWidth/2+window.pageXOffset-20;
   documentHeight=self.innerHeight/2+window.pageYOffset-20;
  }
  adDiv.left=documentWidth-250;
  adDiv.top =documentHeight-150;
  setTimeout("showPopup()",100);
 }else{
  closePopup();
 }
}
function closePopup(){
 if (ie||w3){
  adDiv.display="none";
 }else{
  adDiv.visibility ="hide";
 }
}
οnlοad=initPopup;

把弹出代码放在想执行的文件中就可以了.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值