gpt4 book ai didi

javascript - 为什么我不能使用 javascript 和 jquery 读取文本文件?

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

这是代码:

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> 
<script src="http://newsxpressmedia.com/files/theme/jquery.newsTicker.js"></script>
<script>$(function() {
var file = "http://newsxpressmedia.com/files/theme/test.txt";
$.get(file, function (txt) {
//var lines = txt.responseText.split("\n");
var lines = txt.split("\n");
$ul = $('<ul class="newsticker" />');
for (var i = 0, len = lines.length; i < len; i++) {
//save(lines[i]); // not sure what this does
$ul.append('<li>' + lines[i] + '</li>');
}
//$ul.appendTo('body').newsTicker({
$ul.appendTo('div.wcustomhtml').newsTicker({
row_height: 48,
max_rows: 2,
speed: 6000,
direction: 'up',
duration: 1000,
autostart: 1,
pauseOnHover: 1
});
});
});

autostart: 1,
pauseOnHover: 0
});
</script>

链接存在,不给404找不到。但是我没有看到正在读取的文本文件中的行。

我在“审核”选项卡中单击我的网站 Ctrl+Shist+C 我看到一个错误:

Unexpected token: test.html:120 我点击它,只有一个空行就是这样。我没有使用也没有任何名为 test.html 的文件

目标是 jquery 每次读取一两行并将其向上滚动。

这是网站:

http://newsxpressmedia.com/test.html

最佳答案

您的 JavaScript 代码格式不正确。从您的 javascript 中删除它:

    autostart: 1,
pauseOnHover: 0
});

关于javascript - 为什么我不能使用 javascript 和 jquery 读取文本文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23320669/

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