gpt4 book ai didi

JavaScript 干扰

转载 作者:行者123 更新时间:2023-11-30 10:53:57 27 4
gpt4 key购买 nike

这是我的 <head> + <body>部分:

<script type="text/javascript" src="http://www.septa.org/site/js/jquery-1.4.2.js">
<script type="text/javascript">
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")
{
linkElementLnk.style.display = 'none';
}
if (loc_array[loc_array.length-3] == "maps" || loc_array[loc_array.length-2] == "stations" || loc_array[loc_array.length-3] == "stations" )
{
linkElementLnk.style.display = 'block';
var newT = document.createTextNode("Stations & Maps");
}
if (loc_array[loc_array.length-2] == "w" || loc_array[loc_array.length-2] == "s" || loc_array[loc_array.length-2] == "h" )
{
linkElementLnk.style.display = 'block';
var newT = document.createTextNode(unescape(capWords(loc_array[loc_array.length-2])));
}
else if (loc_array[loc_array.length-3] != "m")
{
linkElementLnk.style.display = 'block';
if (loc_array[loc_array.length-1] == "index.html" || loc_array[loc_array.length-1] == "index.shtml" || loc_array[loc_array.length-1] == "")
{
var newT = document.createTextNode(unescape(capWords(loc_array[loc_array.length-3])));
}
else
{
var newT = document.createTextNode(unescape(capWords(loc_array[loc_array.length-2])));
}
}
linkElement.appendChild(newT);
}
function capWords(str){
var words = str.split(" ");
for (var i=0 ; i < words.length ; i++){
var testwd = words[i];
var firLet = testwd.substr(0,1);
var rest = testwd.substr(1, testwd.length -1)
words[i] = firLet.toUpperCase() + rest
}
return words;
}
</script>
<script type="text/javascript" src="http://www.septa.org/site/js/qTip.js"></script>
<style>
div#qTip {
padding: 3px;
border: 1px solid #666;
border-right-width: 2px;
border-bottom-width: 2px;
display: none;
background: #1c1c1c;
color: #FFF;
font: bold 9px Verdana, Arial, Helvetica, sans-serif;
text-align: left;
position: absolute;
z-index: 1000;
}
</style>
</head>
<body onload="insert();">

当我有 onload="insert();"在我的 <body>它使 jQuery 工具提示无法工作。有人知道解决这个问题的方法吗?

最佳答案

我查看了代码:http://www.septa.org/site/js/qTip.js您在上面包括的那个。

猜猜我发现了什么?大奖!

window.onload = function () {
tooltip.init ();
}

因此,当您将自己的函数添加到 body 标记中时,它会覆盖工具提示函数。

关于JavaScript 干扰,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3346817/

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