Jquery中的Jquery
我试图在jquery slideup滑下请求中生成一些文本,但当我添加另一个jquery代码时,它显示了这一点Jquery中的Jquery,jquery,Jquery,我试图在jquery slideup滑下请求中生成一些文本,但当我添加另一个jquery代码时,它显示了这一点 ​ 这是我的代码 <head> <script type="text/javascript"> <!-- HIDE FROM INCOMPATIBLE BROWSERS var fish1Position = 0; var fish2Position = 0; var fish3Position = 99; var horizontal
​
这是我的代码
<head>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
var fish1Position = 0;
var fish2Position = 0;
var fish3Position = 99;
var horizontal = [];
var fillPosition = 10;
var num = 100;
for(var i = 0; i < 100; ++i) {
horizontal[i] = fillPosition;
fillPosition += 10;
}
function fish1Swim() {
document.getElementById("fish1").style.left = horizontal[fish1Position] + "px";
++fish1Position;
if (fish1Position == num) {
fish1Position = 0;
}
var tim1 = setTimeout(fish1Swim, 100);
}
function fish2Swim(){
document.getElementById("fish2").style.left = horizontal[fish2Position] + "px";
++fish2Position;
if (fish2Position == num) {
fish2Position = 0;
}
var tim2 = setTimeout(fish2Swim, 200);
}
function fish3Swim() {
document.getElementById("fish3").style.left = horizontal[fish3Position] + "px";
++fish3Position;
if (fish3Position == num) {
fish3Position = 99;
}
var tim3 = setTimeout(fish3Swim, 300);
}
function startSwimming() {
fish1Swim();
fish2Swim();
fish3Swim();
}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
<body>
<ul>
<li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'> {$nhlteam} <span id='fish1'>{$nhlmessage}</span></li>
<li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'> {$nhlteam} <span id='fish1'>{$nhlmessage}</span></li>
</ul>
/////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
<!-- include jQuery core code -->
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script>
$(document).ready(function() {
function textloop() {
// get the item that currently has the 'show' class
var current = $('#items .show');
/*
* find the next item with some help from jQuery's ternary operator
* the syntax for the ternary operator is 'a ? b : c'
* in other words 'if a is true return b otherwise return c'
*/
var next = current.next().length ? current.next() : current.parent().children(':first');
// fade out the current item and remove the 'show' class
current.delay(5000).slideUp('slow',function(){
// fade in the next item and add the 'show' class
next.slideDown('slow').addClass('show');
}).removeClass('show');
// repeat by calling the textloop method again after 3 seconds
setTimeout(textloop,0);
}
// call the text loop method when the page loads
textloop();
});
</script>
////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
- {$nhlteam}{$nhlmessage}
- {$nhlteam}{$nhlmessage}
/////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
$(文档).ready(函数(){
函数textloop(){
//获取当前具有“show”类的项目
当前变量=$('#items.show');
/*
*在jQuery的三元运算符的帮助下查找下一项
*三元运算符的语法为“a?b:c”
*换句话说,“如果a为真,则返回b,否则返回c”
*/
var next=current.next().length?current.next():current.parent().children(':first');
//淡出当前项目并删除“显示”类
当前.delay(5000).slideUp('slow',function(){
//淡入下一项并添加“show”类
next.slideDown('slow').addClass('show');
}).removeClass(“show”);
//在3秒钟后再次调用textloop方法进行重复
setTimeout(textloop,0);
}
//加载页面时调用文本循环方法
textloop();
});
有没有关于让列表中的文本滚动的帮助?pref在我可以识别的标记中,因为我不希望整个脚本从右向左滚动尝试将PHP值输出修改为:
<li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'><?php echo $nhlteam ?><span id='fish1'><?php echo $nhlmessage ?></span></li>
李>
您看到的符号是指向变量的内存指针的ASCII表示形式。您是否尝试链接到外部脚本而不是嵌入脚本?我是否仍要将脚本标记环绕跨度?我仍在获取text@ZacharyTylerWiggins当前位置很难理解这里的问题。您在哪一行代码上看到问题?发生这种情况时,相关的运行时值是什么?您能在一个实时位置(比如JSFIDLE)或某个自托管页面上演示这一点吗?从我的想法来看,围绕php调用包装java可能会由于字符编码而导致此错误。不管怎么说,要解决这个问题?我现在就这么做了,它没有回响字符串,哈哈,我知道字符串中有东西。。。。。grrr我因为问了一个好问题而被否决了。谢谢你的帮助!