JavaScript code for drawing advertisements in the text on the Information Page (loading the advertisement mode in the text) and

Source: Internet
Author: User

JavaScript code for drawing advertisements in the text on the Information Page (loading the advertisement mode in the text) and

The Helper's house editor directly gave the Code:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

Core js Code:

<Script type = "text/javascript"> var sti; var resize = function (temp, ad) {var timer, count = 0, limit = 50; timer = setInterval (function () {var tempOffset = temp. offset (); var adOffset = ad. offset (); count + = 1; ad.css ({left: tempOffset. left, top: tempOffset. top}); if (count> = limit | adOffset. top === tempOffset. top) {clearInterval (timer) }}, 100) ;}; function check_show (container, caid, order) {var ad =$ ('#' + caid); var offset; var temp = $ ('<div> '0000.css ({'float': 'left', width: ad. width (), height: ad. height (), margin: '10px 10px 10px 0'}); if (ad. height ()> 10) {$ ("#" + container + "p "). eq (order ). after (temp); offset = temp. offset (); ad.css ({position: 'absolute ', left: offset. left, top: offset. top }). show (); resize (temp, ad); clearInterval (sti) ;}} function weneiAd (container, aid) {var p =$ ("#" + container ). find ("p "). size (); var img = $ ("#" + container ). find ("img "). size (); var caid = 'Article _ ad0'; var order = 0; if (img> 1 & p <= 3) {} else if (img = 1 & p> 3) {order = 1;} else if (img = 0 & p> 3) {order = 1 ;} else if (img> 1 & p> 5) {order = 5;} if (order> 0) {// document. write ("<div style = \" float: left; margin: 10px 10px 0; display: none \ "id = \" "+ caid +" \ "> "); document. write ('<font color = red> 文中 </font>'); document. write ("<font color = red> the inner picture of the help house information page ends </font>"); // document. write ("<\/div>"); // document. write ("<div style = 'clear: both '> <\/div>"); sti = setInterval (function () {check_show (container, caid, order );}, 500) ;}} weneiAd ('articletext', 4); </script>

It is mainly about order's university-controlled advertising position, which can be modified as needed.

This requires jquery to be loaded. Of course, there are some methods on the Internet that need to determine the length of characters to be intercepted, which are all good.

Of course, there are a lot of advertisements and the control is good. You can go to Sina to view the advertisements on his content page.

Articles you may be interested in:
  • How to insert an asp picture-in-picture advertisement into each 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.