Home › Forums › JavaScript › Make a div disapear on blogger! Thanks!
- This topic is empty.
-
AuthorPosts
-
June 29, 2010 at 9:38 pm #29503renanholandaMember
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/"){
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/"){
result = " ";
}is that since I only want that div on that href anything different and the result should be blank.
Thanks!</script>
July 2, 2010 at 10:52 am #79181renanholandaMemberI 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/" || location.href == "http://www.hollandsales.blogspot.com/"){
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!
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.