2010-07-13 4 views
0
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); 
} 

et voici mon code HTMLstyle d'affichage Javascript ne fonctionne pas

<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> 

La none style.display ne fonctionne pas et semble être juste briser le script. Est-ce que je manque quelque chose?

Répondre

2

vérifier votre orthographe

var linkElementLnk = document.getElementById("BackButtonlnk"); 
... 
linkElementLink.style.display = 'none'; 
+0

Touché! belle prise – Anurag

+0

Haha a accepté. Merci. – balexander

0

Essayez

style.display = '';