Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Make a div disapear on blogger! Thanks!

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29503
    renanholanda
    Member

    Hi,
    Before anything, I have to do the usual apologizing because I’m a noob. Now, here is my story, I am trying to learn web designing and what better way to learn than by doing it?! I am practicing in a blog, no hosting fee! But on blogger you cant really customize each page. So, I am trying to use javascript so that a special <div id="yellowbar"></div> only show any content when the page http://hollandsales.blogspot.com/ is loaded. This is what I tried:

    <script type=’text/javascript’>
    //<![CDATA[
    function changeYellobar{
    if(location.href != "http://hollandsales.blogspot.com/&quot;){
    result = " ";
    }
    yellowbar.innerHTML = result;
    }
    //]]>

    However, it did not work out. Any thoughts? Also, I had this code inserted in the <head></head>, and do I need to do any coding on that specific <div id="yellowbar"></div>. My reasoning on the:

    if(location.href != "http://hollandsales.blogspot.com/&quot;){
    result = " ";
    }

    is that since I only want that div on that href anything different and the result should be blank.
    Thanks!

    </script>

    #79181
    renanholanda
    Member

    I changed the code a little to:

    <script type=’text/javascript’>
    //<![CDATA[
    function changeYellowbar(){

    //get variables
    var yellowbar = document.getElementById("yellowbar");
    var result = "";
    var altura = "";

    if(location.href == "http://hollandsales.blogspot.com/&quot; || location.href == "http://www.hollandsales.blogspot.com/&quot;){
    result += "<img class=’book’ src=’//quickreg.ce43.com/img/book.gif’/> n";
    result += "<img class=’cell’ src=’//www.gifted.uconn.edu/nviews/images/cellphone.gif’/> n";
    result += "<img class=’laptop’ src=’//saddlebrook.bccls.org/laptop.gif’/> n";
    altura = "150px";
    }
    else{
    result = " ";
    altura = "0px";
    }

    yellowbar.innerHTML = result;
    yellowbar.style.height = altura;
    }
    //]]>
    </script>

    Now, it works fine. Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.