Javascript pop-up ad effect code in lower right corner

Source: Internet
Author: User
Tags setinterval

Advertising Code

The code is as follows Copy Code

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Lower right corner pop-up box </title>
<style type= "Text/css" >
#rbbox {Position:absolute;right:0;bottom:0;width:300px;height:0px;overflow:hidden}
. Button{display:inline;float:right;font-size:12px;cursor:pointer}
</style>
<body><div id= "Rbbox" ><a class= "button" onclick= "CloseBox ()" > Close </a><iframe src= "http:// Www.111cn.net "frameborder=" 0 "height=" width= "No." Scrolling= "no" ></iframe></div>
</body>
<script language= "javascript" type= "Text/javascript" >
Window.onload=function () {Showbox (); SetTimeout ("CloseBox ()", 5000)}
function Showbox (o) {
if (o==undefined) O=document.getelementbyid ("Rbbox");
o.style.height=o.clientheight+2+ "px";
if (o.clientheight<200) settimeout (function () {Showbox (o)},5);
}
function CloseBox () {document.getElementById ("Rbbox"). style.display= "None";
</script>


Code two

The code is as follows Copy Code


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> information box in the lower right corner of the Web page </title>
<style type= "Text/css" >
#winpop {width:200px; height:0px; position:absolute; right:0; bottom:0; border:1px solid #666; margin:0; padding:1px Rflow:hidden; Display:none;}
#winpop. title {width:100% height:22px; line-height:20px; background: #FFCC00; font-weight:bold; text-align:center; font-size:12px;}
#winpop. con {width:100%; height:90px; line-height:80px; font-weight:bold; font-size:12px; color: #FF0000; Text-decoration:underline; Text-align:center}
#silu {font-size:12px; color: #666; position:absolute; right:0; text-align:right; text-decoration:underline; line-height:22px;}
. close {position:absolute; right:4px; top:-1px; color: #FFF; Cursor:pointer}
</style>
<script type= "Text/javascript" >
function Tips_pop () {
var Msgpop=document.getelementbyid ("Winpop");
var poph=parseint (MsgPop.style.height);//Convert the height of an object to a number
if (poph==0) {
msgpop.style.display= "block";//Show hidden windows
Show=setinterval ("Changeh (' Up ')", 2);
}
else {
Hide=setinterval ("Changeh (' Down ')", 2);
}
}
function Changeh (str) {
var Msgpop=document.getelementbyid ("Winpop");
var poph=parseint (MsgPop.style.height);
if (str== "up") {
if (poph<=100) {
Msgpop.style.height= (poph+4). toString () + "px";
}
else{
Clearinterval (show);
}
}
if (str== "down") {
if (poph>=4) {
Msgpop.style.height= (popH-4). toString () + "px";
}
else{
Clearinterval (hide);
Msgpop.style.display= "None"; Hide Div
}
}
}
Window.onload=function () {//load
document.getElementById (' winpop '). style.height= ' 0px ';
SetTimeout ("Tips_pop ()", 800);//3 seconds later call Tips_pop () this function
}
</script>
<body>
<div id= "Silu" >
<button onclick= "Tips_pop ()" >3 seconds later in the lower right corner automatically pop-up window, if not pop-up please click this button </button>
</div>
<div id= "Winpop" >
<div class= "title" > You have new short message! <span class= "Close" onclick= "Tips_pop ()" >X</span></div>
<div class= "Con" >1 unread information (</div>
</div>
</body>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.