views:

33

answers:

2
function insert()
{
    var linkElement = document.getElementById("BackButton");
    var linkElementLnk = document.getElementById("BackButtonlnk");
    var loc_array = document.location.href.split('/');

    if (loc_array[loc_array.length-3] == "m")
    {
        linkElementLink.style.display = 'none';
    }
    else if (loc_array[loc_array.length-2] == "maps"
          || loc_array[loc_array.length-3] == "maps"
          || loc_array[loc_array.length-2] == "stations"
          || loc_array[loc_array.length-3] == "stations" )
    {
        var newT = document.createTextNode("Stations & Maps");
    }
    else
    {
        var newT = document.createTextNode(unescape(capWords(loc_array[loc_array.length-3])));
    }
    linkElement.appendChild(newT);
}

and here is my HTML

<a id="BackButtonlnk" href="#" class="white" onClick="history.go(-1); return false;">
    <div id="BackButton1"></div>
    <div id="BackButton"></div>
    <div id="BackButton3"></div>
    </a>

The style.display none is not working and seems to just be breaking the script. Am I missing something?

A: 

Try

style.display = '';
Joel Etherton
+2  A: 

check your spelling

var linkElementLnk = document.getElementById("BackButtonlnk");
...
linkElementLink.style.display = 'none';
Scott Evernden
touche! nice catch
Anurag
Haha agreed. Thanks.
Bry4n