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