23/02/13

How To Create Floating Ads On Blogger/Blogspot

Diposting oleh Unknown


Floating top bar ads is an ads in the box that will be always on the top of your blog post until it is closed. For implementation with adsense, I suppose you toread Google policy about Adsense implementation policy.
1. Login to Blogger. Got to your blog --> Design --> Edit HTML.
2. Place the script below at position after <head> dan before </head>. Don't forget to escape this html code so it can be implemented in blogger.

01&lt;style type=&quot;text/css&quot;&gt;
02    #topbar{
03    position:absolute;
04    border: 1px solid black;
05    padding: 2px;
06    background-color: lightyellow;
07    width: 338px;
08    visibility: hidden;
09    z-index: 100;
10    }
11    &lt;/style&gt;
12    &lt;script type=&quot;text/javascript&quot;&gt;
13    /***********************************************
14    * Floating Top Bar script- &#65533; Dynamic Drive (www.dynamicdrive.com)
15    * Sliding routine by Roy Whittle (http://www.javascript-fx.com/)
16    * This notice must stay intact for legal use.
17    * Visit http://www.dynamicdrive.com/ for full source code
18    ***********************************************/
19    var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
20    var startX = 320 //set x offset of bar in pixels
21    var startY = 5 //set y offset of bar in pixels
22    var verticalpos=&quot;fromtop&quot; //enter &quot;fromtop&quot; or &quot;frombottom&quot;
23    function iecompattest(){
24    return (document.compatMode &amp;&amp; document.compatMode!=&quot;BackCompat&quot;)? document.documentElement : document.body
25    }
26    function get_cookie(Name) {
27    var search = Name + &quot;=&quot;
28    var returnvalue = &quot;&quot;;
29    if (document.cookie.length &gt; 0) {
30    offset = document.cookie.indexOf(search)
31    if (offset != -1) {
32    offset += search.length
33    end = document.cookie.indexOf(&quot;;&quot;, offset);
34    if (end == -1) end = document.cookie.length;
35    returnvalue=unescape(document.cookie.substring(offset, end))
36    }
37    }
38    return returnvalue;
39    }
40    function closebar(){
41    if (persistclose)
42    document.cookie=&quot;remainclosed=1&quot;
43    document.getElementById(&quot;topbar&quot;).style.visibility=&quot;hidden&quot;
44    }
45    function staticbar(){
46    barheight=document.getElementById(&quot;topbar&quot;).offsetHeight
47    var ns = (navigator.appName.indexOf(&quot;Netscape&quot;) != -1) || window.opera;
48    var d = document;
49    function ml(id){
50    var el=d.getElementById(id);
51    if (!persistclose || persistclose &amp;&amp; get_cookie(&quot;remainclosed&quot;)==&quot;&quot;)
52    el.style.visibility=&quot;visible&quot;
53    if(d.layers)el.style=el;
54    el.sP=function(x,y){this.style.left=x+&quot;px&quot;;this.style.top=y+&quot;px&quot;;};
55    el.x = startX;
56    if (verticalpos==&quot;fromtop&quot;)
57    el.y = startY;
58    else{
59    el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
60    el.y -= startY;
61    }
62    return el;
63    }
64    window.stayTopLeft=function(){
65    if (verticalpos==&quot;fromtop&quot;){
66    var pY = ns ? pageYOffset : iecompattest().scrollTop;
67    ftlObj.y += (pY + startY - ftlObj.y)/8;
68    }
69    else{
70    var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
71    ftlObj.y += (pY - startY - ftlObj.y)/8;
72    }
73    ftlObj.sP(ftlObj.x, ftlObj.y);
74    setTimeout(&quot;stayTopLeft()&quot;, 10);
75    }
76    ftlObj = ml(&quot;topbar&quot;);
77    stayTopLeft();
78    }
79    if (window.addEventListener)
80    window.addEventListener(&quot;load&quot;, staticbar, false)
81    else if (window.attachEvent)
82    window.attachEvent(&quot;onload&quot;, staticbar)
83    else if (document.getElementById)
84    window.onload=staticbar
85    &lt;/script&gt;


3. Save Template
4. Click Layout
5. Click Add Gadget
6. Choose HTML/JavaScript
7. Place script below

1<div id="topbar">
2    <a href="" onClick="closebar(); return false"><img src=http://i729.photobucket.com/albums/ww298/trimulyawan/close.gif " border="0" /></a>
3    ---- Paste your adsense here ----
4    </div>


8. Save

0 komentar:

Silahkan komentar nya mas mba kece