JavaScript-Floating AD window instances

Source: Internet
Author: User

Floating Ads Window
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" ><html><head><meta http-equiv="Content-type" Content="text/html; Charset=utf-8 "><title>Floating Ads Window</title><style type="Text/css">    #mydiv{  width: +px;         Height: +px;     background:#f00; }    #content{  text-align:center; }    #adv{  position:absolute;         top:px;    Left  :px; }    #close{  position:absolute;         top:px;    Left  :164px; }</style><script type="Text/javascript">        varAdvobj;varAdvtop;varAdvleft;varCloseobj;varClosetop;varCloseleft;//Get the initial position of the ad         function Place(){advobj=$ ("ADV"); closeobj=$ ("Close");if(Advobj.currentstyle)                {advtop=advobj.currentstyle.top;                Advleft=advobj.currentstyle.left;                Closetop=closeobj.currentstyle.top;                           Closeleft=closeobj.currentstyle.left; }Else{advtop=parseint(Document.defaultView.getComputedStyle (Advobj,NULL). top); advleft=parseint(Document.defaultView.getComputedStyle (Advobj,NULL). left); closetop=parseint(Document.defaultView.getComputedStyle (Closeobj,NULL). top); closeleft=parseint(Document.defaultView.getComputedStyle (Closeobj,NULL). left); }} window.onload= function(){        //var width=$ ("mydiv"). Style.width;            //Get properties that use inline style adornments/* IF ($ ("mydiv"). Currentstyle) {//The client is determined to make the browser var width=$ ("Mydiv"). Currentstyle.width;            }else{var Width=document.defaultview.getcomputedstyle ($ ("mydiv"), null). Width;//The second parameter represents a pseudo-element, which is generally set to null } alert (width); */Place (); $("Close"). onclick= function(){$("Close"). style.display="None"; $("ADV"). style.display="None";        }; }; function scroll(){advobj.style.top=parseint(advtop) +parseint(DOCUMENT.DOCUMENTELEMENT.SCROLLTOP) +"px"; advobj.style.left=parseint(Advleft) +parseint(Document.documentElement.scrollLeft) +"px"; closeobj.style.top=parseint(closetop) +parseint(DOCUMENT.DOCUMENTELEMENT.SCROLLTOP) +"px"; closeobj.style.left=parseint(Closeleft) +parseint(Document.documentElement.scrollLeft) +"px"; } window.onscroll= function(){Scroll (); }; function $(ID){            returndocument.getElementById (ID); }</script></head><body><!--<div id= "mydiv" > Hehe </div>-->    <div id="Content"><img src="images/contentpic.jpg" /></div>      <div id="adv"><img src="images/advpic.jpg" /></div>    <div id="Close"><img src="images/close.jpg" /></div></body></html>

JavaScript-Floating AD window instances

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.