gpt4 book ai didi

Javascript 样式显示不工作

转载 作者:行者123 更新时间:2023-11-30 13:39:07 26 4
gpt4 key购买 nike

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);
}

这是我的 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>

style.display none 不起作用,似乎只是破坏了脚本。我错过了什么吗?

最佳答案

检查拼写

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

关于Javascript 样式显示不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3239654/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com