-2

我正在尝试在 jquery slideup 向下滑动请求中制作一些文本,但是当我添加另一个 jquery 代码时,它显示了这一点

​

所以这是我的代码

<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} ​&lt;span id='fish1'>{$nhlmessage}</span></li>
<li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'> {$nhlteam} ​&lt;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>

对使列表中的文本滚动有什么帮助吗?pref 在我可以识别的标签中,因为我不希望整个脚本从右到左滚动

4

1 回答 1

0

尝试将您的 PHP 值输出修改为:

 <li><img src='http://station2k.com/blank-hockey-puck.png' width='17px' height='17px'><?php echo $nhlteam ?>​&lt;span id='fish1'><?php echo $nhlmessage ?></span></li>

您看到的符号是指向变量的内存指针的 ASCII 表示。

于 2013-04-08T18:33:00.247 回答