gpt4 book ai didi

javascript - 一个 HTML 文件中的分页

转载 作者:行者123 更新时间:2023-12-02 21:19:43 25 4
gpt4 key购买 nike

这是工作示例 https://www.codeply.com/go/bp/lxa0FF9yhw#我需要在一个 html 文件中工作。

我正在使用此模板来合并 HTML、Css 和 javascript:

<html>
<head>
<style type="text/css">
CSS goes here
</style>
<script type="text/javascript">
JS goes here
</script>
</head>

<body>
HTML goes here
</body>
</html>

但结果我看到的是表格的所有行而不是页面。这是 Bootstrap 的问题吗?我包括 jQuery 和 javascript

<script src='http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.js'></script>
<script src='script.js' type="text/javascript"></script>

我仍然可以看到结果中的所有行。我在https://jsfiddle.net/tfyqwLkr/中尝试了这段代码。它还显示表的所有行。在这种情况下如何包含所有必需的元素?

最佳答案

尝试将 Javascript 放在正文结束标记之前:</body> .

您可能正在调用尚未解析的 DOM 元素。

<html>
<head>
<style type="text/css">
/* CSS goes here */
</style>
</head>
<body>
<!-- HTML goes here -->

<script src='http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.js'></script>
<script src='script.js' type="text/javascript"></script>
<script type="text/javascript">
// JS goes here
</script>
</body>
</html>
<小时/>

编辑:发布代码后,看起来您正在尝试调用 size() ,一个deprecated method从 jQuery 3.0 开始。

Note: This method has been removed in jQuery 3.0. Use the .length property instead.

这会在控制台中引发一些错误。更改children.size()children.length

检查更新的Fiddle 。 (第 23 行)

关于javascript - 一个 HTML 文件中的分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60878938/

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