* Graham MARK ACTIVE NAVIGATION
Sets the class 'active' on the current item
example of very basic header structure
<div class="nav mark-active"><a href="/">home</a><a href="/blog">blog</a></div>
<script>
// Mark active navigation item (Current page)
  if ( document.getElementsByClassName('mark-active') )
  {
    window.mark_active = function ()
      {
        var items = document.getElementsByClassName('mark-active');
        if ( items != undefined && items != null && items [0] != undefined )
        {
          for (var h = 0; h < items.length; h++)
          {
            var item = items[h].childNodes;
            var loc = decodeURI ( document.location.pathname ).replace ( ' ', '+' ).replace ( /\/__xt.+/, '' );
            for (var i = 0; i < item.length; i++)
            {
              if (item [ i ] && item [ i ].getAttribute && item [ i ].getAttribute('href') == loc)
              { 
                item[i].className += ' active'; break; 
              };
            }
          }
        }
      };
    window.mark_active ();
  }</script>

Copy code
2017-04-07 23:27 (edited 2017-04-08 03:43 by Graham ) · (0)
* Keyarn * Graham Let me give it a try buh this de site dat have what i mean @ http://examthings.yn.lt there you will see HOME JAMB WAEC NECO NABTEP e.t.c in his header then in de home page de link HOME will have blue background and asuming you clicked On jamb then the blue background will move to the JAMB. So home can i code it
2017-04-08 04:14 · (0)
* Graham * Keyarn You already have a code to do this and it seems to be working for the 'home' link but your other pages do not have that header so I cannot tell if it works for them
your code for this actually looks better than mine
2017-04-08 04:33 (edited 2017-04-08 04:36 by Graham ) · (0)
* Keyarn * Graham But de site is Not mine nah i dont have it on my site thats why i need it i use http://examthings.yn.lt for example
2017-04-08 12:22 · (0)
* Graham * Keyarn then you could probably use the 'xtgem built in method' described below
I am using the xtgem method on this site http://bootstrap337.xtgem.com/
2017-04-08 13:34 (edited 2017-04-08 14:19 by Graham ) · (0)
* Keyarn * Graham Sir i hosted this script in a file name Ads.js
var x = document.getElementsByClassName("ads_pop_in");
var y = Math.floor(Math.random() * x.length);
var z = Math.floor(Math.random() * x.length);
x[y].innerHTML = '\<div class=\"ad\"\>\<b\><div class="full" style="background:url(/B/Bg/download.png)"><table cellspacing="0px"><tr align="middle"><td align="left"><img src="http://keyarn.xtgem.com/admin/Icons/ad.png" alt="**" class="ico" width="27px" height="30px" /></td><td align="left"><img src="http://keyarn.xtgem.com/Admin/rating.gif" /><br/><a href="http://wap4dollar.com/ad/serve.php?id=9zxsoiy497"><img src="http://wap4dollar.com/ad/imgs/wap4dollar_banner_6.jpg" width="300" height="50" alt="" /></a></td></tr></table></div><hr style="border:1px dotted red;"/>\</b\>\</div\>';
x[z].innerHTML = '\<div class=\"ad\"\>\<b\><div class="full" style="background:url(/B/Bg/download.png)"><table cellspacing="0px"><tr align="middle"><td align="left"><img src="http://keyarn.xtgem.com/admin/Icons/ad.png" alt="**" class="ico" width="27px" height="30px" /></td><td align="left"><img src="http://keyarn.xtgem.com/admin/rating.gif" /><br/><a href="http://wap4dollar.com/ad/serve.php?id=9zxsoiy497"><img src="http://wap4dollar.com/ad/imgs/wap4dollar_banner_3.jpg" alt="" /></a></td></tr></table></div><hr style="border:1px dotted red;"/>\</b\>\</div\>';

Copy code
and then try to <script src="/Ads.js"> to show it where i want but it is not working else i paste it Externally plz do you know why?
2017-04-25 02:03 · (0)
* Graham * Keyarn Works ok for me
the script tag needs to be BELOW the elements with the class 'ads_pop_in' ?
2017-04-25 03:33 (edited 2017-04-25 03:34 by Graham ) · (0)
* Keyarn * Graham Xori thats not the code i wanted to drop here is de one
function ads(){
var a=[
'http://wap4dollar.com/ad/imgs/wap4dollar_banner_6.jpg',
'http://wap4dollar.com/ad/imgs/wap4dollar_banner_5.gif',
'http://wap4dollar.com/ad/imgs/wap4dollar_banner_4.jpg',
'http://wap4dollar.com/ad/imgs/wap4dollar_banner_3.jpg',
'http://wap4dollar.com/ad/imgs/wap4dollar_banner_2.jpg',
'http://wap4dollar.com/ad/imgs/wap4dollar_banner_1.gif',
'http://wap4dollar.com/ad/banner.png' ];
var b=Math.floor(Math.random()*(a.length));
return a[b];}

var x = document.getElementsByClassName("descr");
var y = Math.floor(Math.random() * x.length);
var z = Math.floor(Math.random() * x.length);
x[y].innerHTML = '\<div class=\"ad\"\>\<b\><div class="descr" style="background:url(/B/Bg/download.png)"><table cellspacing="0px"><tr align="middle"><td align="left"><img src="http://keyarn.xtgem.com/admin/Icons/ad.png" alt="**" class="ico" width="27px" height="30px" /></td><td align="left"><br/><a href="http://wap4dollar.com/ad/serve.php?id=9zxsoiy497"><img src="'+ads()+'" width="300" height="50" alt="" /></a></td></tr></table></div><hr style="border:1px dotted red;"/>\</b\>\</div\>';
x[z].innerHTML = '\<div class=\"ad\"\>\<b\><div class="descr" style="background:url(/B/Bg/download.png)"><table cellspacing="0px"><tr align="middle"><td align="left"><img src="http://keyarn.xtgem.com/admin/Icons/ad.png" alt="**" class="ico" width="27px" height="30px" /></td><td align="left"><br/><a href="http://wap4dollar.com/ad/serve.php?id=9zxsoiy497"><img src="'+ads()+'"></a></td></tr></table></div><hr style="border:1px dotted red;"/>\</b\>\</div\>';

Copy code
at http://keyarn.xtgem.com/banner
2017-04-25 20:26 (edited 2017-04-25 21:01 by Keyarn ) · (0)
* Graham * Keyarn Same outcome works fine for me http://adgj.mw.lt/0000jst
2017-04-25 21:42 · (0)
* Keyarn * Graham I dont know what is wrong in my own it doesn work both in external again after i edited it
<script> 
function ads(){
var a=[
'https://www.jumia.com/affiliate-program/banners/9/77/336x280.jpg',
'https://jumia.com/affiliate-program/banners/Jumia Nigeria/Womens Shoes/336X280.jpg',
'https://jumia.com/affiliate-program/banners/Jumia Nigeria/Extreme Home Makeover/336X280.jpg',
'http://jumia.co/nl-templates-kenya/Affiliates/Newsletter/GDN/NG/Baby%20%26%20Kids/336X280.jpg',
'https://www.jumia.com/affiliate-program/banners/9/77/336x280.jpg',
'http://jumia.co/nl-templates-kenya/Affiliates/Newsletter/GDN/NG/Baby%20%26%20Kids/336X280.jpg',
'https://jumia.com/affiliate-program/banners/Jumia Nigeria/Womens Shoes/336X280.jpg' ];
var b=Math.floor(Math.random()*(a.length));
return a[b];}

var x = document.getElementsByClassName("foo");
var y = Math.floor(Math.random() * x.length);
var z = Math.floor(Math.random() * x.length);
x[y].innerHTML = '\<div class=\"ad\"\>\<b\><div class="descr" style="background:url(/B/Bg/download.png)"><table cellspacing="0px"><td align="middle"><br/><a href="http://c.jumia.io/?a=31746&c=11&p=r&E=kkYNyk2M4sk%3d&ckmrdr=&utm_source=cake&utm_medium=affiliation&utm_campaign=31746&utm_term="><img src="'+ads()+'" width="300" height="50" alt="" /></a></td></table></div><hr style="border:1px dotted red;"/>\</b\>\</div\>';
x[z].innerHTML = '\<div class=\"ad\"\>\<b\><div class="descr" style="background:url(/B/Bg/download.png)"><table cellspacing="0px"><td align="middle"><br/><a href="http://c.jumia.io/?a=31746&c=11&p=r&E=kkYNyk2M4sk%3d&ckmrdr=&utm_source=cake&utm_medium=affiliation&utm_campaign=31746&utm_term="><img src="'+ads()+'"></a></td></tr></table></div><hr style="border:1px dotted red;"/>\</b\>\</div\>';
</script>

Copy code
plz try it and tell me if it work 4 u am in need of it
2017-04-25 22:10 · (0)

Online: Guests: 1