A collection of js couplet advertisements with good running compatibility under w3c statement

Source: Internet
Author: User

Finally, we provide the appropriate code:
Core code:

Copy codeThe Code is as follows: lastScrollY = 0;
Function heartBeat (){
Var diffY;
If (document.doc umentElement & document.doc umentElement. scrollTop)
DiffY = document.doc umentElement. scrollTop;
Else if (document. body)
DiffY = document. body. scrollTop
Else
{/* Netscape stuff */}

// Alert (diffY );
Percent =. 1 * (diffY-lastScrollY );
If (percent> 0) percent = Math. ceil (percent );
Else percent = Math. floor (percent );
Document. getElementById ("leftDIV"). style. top = parseInt (document. getElementById ("leftDIV"). style. top) + percent + "px ";
Document. getElementById ("rightDIV"). style. top = parseInt (document. getElementById ("leftDIV"). style. top) + percent + "px ";

LastScrollY = lastScrollY + percent;
// Alert (lastScrollY );
}

Sidebar1 = "<div id = leftDIV style = 'left: 0px; PosITION: absolute; TOP: 0px; '> <embed src00002010l.swf width = 150 height = 400 quality = high pluginspage = http://www.macromedia.com/go/getflashplayer type = application/x-shockwave-flash scale = exactfit wmode = transparent id = eccooglad> </embed> </div>"
Sidebar2 = "<div id = rightDIV style = 'right: 0px; PosITION: absolute; TOP: 0px; '> <embed src00002010r.swf width = 150 height = 400 quality = high pluginspage = http://www.macromedia.com/go/getflashplayer type = application/x-shockwave-flash scale = exactfit wmode = transparent id = eccooglad> </embed> </div>"

Document. write (sidebar1 );
Document. write (sidebar2 );

// After the following paragraph is deleted, the couplet will not move along with the screen.
Window. setInterval ("heartBeat ()", 1 );
// -->

Function closeAD ()
{
Document. getElementById ("leftDIV"). style. display = 'none ';
Document. getElementById ("rightDIV"). style. display = 'none ';
}

To prevent conflicts, we modified the Code:
Because the customer only needs the code on the right, we leave it blank on the left.Copy codeThe Code is as follows: lastScrollY = 0;
Function heartBeat2 (){
Var diffY;
If (document.doc umentElement & document.doc umentElement. scrollTop)
DiffY = document.doc umentElement. scrollTop;
Else if (document. body)
DiffY = document. body. scrollTop
Else
{/* Netscape stuff */}

// Alert (diffY );
Percent =. 1 * (diffY-lastScrollY );
If (percent> 0) percent = Math. ceil (percent );
Else percent = Math. floor (percent );
Document. getElementById ("leftDIV2"). style. top = parseInt (document. getElementById ("leftDIV2"). style. top) + percent + "px ";
Document. getElementById ("rightDIV2"). style. top = parseInt (document. getElementById ("leftDIV2"). style. top) + percent + "px ";

LastScrollY = lastScrollY + percent;
// Alert (lastScrollY );
}

Sidebar1 = "<div id = leftDIV2 style = 'left: 0px; PosITION: absolute; TOP: 0px; '> </div>"
Sidebar2 = "<div id = rightDIV2 style = 'right: 0px; PosITION: absolute; TOP: 0px; '> <embed src = http://www.pcqc.com.cn/web/rdgqcq/dl/images/rdcq.swf width = 150 height = 400 quality = high pluginspage = http://www.macromedia.com/go/getflashplayer type = application/x-shockwave-flash scale = exactfit wmode = transparent id = eccooad> </ embed> </div>"

Document. write (sidebar1 );
Document. write (sidebar2 );

// After the following paragraph is deleted, the couplet will not move along with the screen.
Window. setInterval ("heartBeat2 ()", 1 );
// -->
Function closeAD ()
{
Document. getElementById ("leftDIV2"). style. display = 'none ';
Document. getElementById ("rightDIV2"). style. display = 'none ';
}

After searching online, I found a good code.Xmlns = "http://www.w3.org/1999/xhtml">

X
X

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.