JQuery 表排序器 未捕获类型错误:对象 #<HTMLDocument> 没有方法'ready'



编辑3:现在可以工作了。感谢@Dimitar的建议,包括重新排序和apache重启,现在它已经解决了。谢谢大家。编辑2中显示的包含顺序是实际顺序。

编辑2:

在检查我看到的文档时,includes总是按相同的顺序排列,所以我重新排序了includes。现在没有错误,但也不起作用。有人知道为什么吗?

新订单:

<?php use_helper('Javascript','Form') ?>
<?php use_javascript('toggleTabActive') ?>
<?php echo javascript_tag("toggleTabActive(15)"); ?>
<?php use_javascript('/sfProtoculousPlugin/js/prototype.js'); ?>
<?php use_javascript('/sfProtoculousPlugin/js/effects.js'); ?>
<?php use_javascript('/sfProtoculousPlugin/js/controls.js'); ?>
<?php use_javascript('jquery-1.3.2.min.js'); ?>
<?php use_javascript('jquery-latest.js'); ?>
<?php use_javascript('jquery.tablesorter.min.js'); ?>
<?php use_stylesheet('tablesorter/style.css') ?>

第1版:根据@Dimitar的建议,我对jquery使用了noconflict。现在:

<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function(){
$j(".urTable" ).tablesorter();
});
</script>

显示的错误为:

1:GET http://sdbweb/css/tablesorter/bg.gif 404 (Not Found)

2:Uncaught TypeError: Object #<Object> has no method 'dispatchEvent'

"1"一定是与表分类器CSS所包含的某个图像相关的路径问题。我以后会调查的。

"2"与prototype.js有关。我猜它也使用JQuery,所以冲突可能是在那里引起的。有关于解决冲突的最佳实践的建议吗?

原件:

这是我第一次使用JQuery,所以很抱歉我问了一些很明显的问题。

我刚开始一份新工作,老板让我对内部网络应用程序进行一些更改,我想在其中一个表中添加排序功能。我发现了有关表格分拣机的信息,并开始着手。

它现在不起作用,我不知道为什么。检查chromium javascript控制台时,出现以下消息:Uncaught TypeError: Object #<HTMLDocument> has no method 'ready'

我在谷歌上搜索过类似的问题,通常都是糟糕的JQuery包含或权限。我确信这不是权限,包括我不知道。

该应用程序使用symfony 1.2,目前无法升级。

我的标题如下:

<?php use_helper('Javascript','Form') ?>
<?php use_javascript('toggleTabActive') ?>
<?php use_javascript('jquery-latest.js'); ?>
<?php use_javascript('jquery.tablesorter.min.js'); ?>
<?php use_javascript('jquery-1.3.2.min.js'); ?>
<?php echo javascript_tag("toggleTabActive(15)"); ?>
<?php use_javascript('/sfProtoculousPlugin/js/prototype.js'); ?>
<?php use_javascript('/sfProtoculousPlugin/js/effects.js'); ?>
<?php use_javascript('/sfProtoculousPlugin/js/controls.js'); ?>
<?php use_stylesheet('tablesorter/style.css') ?>
<script type="text/javascript">
$(document).ready(function(){
$(".urTable" ).tablesorter();
});
</script>

表格:

<table class="tablesorter urTable" width="100%" cellspacing="0" cellpadding="1" border="0">
        <thead>
        <tr class="collection-as-table">
          <th class="collection-as-table"></th>
          <th class="collection-as-table">Access</th>
          <th class="collection-as-table">Name</th>
          <th class="collection-as-table">Activity</th>
          <th class="collection-as-table">Machine</th>
          <th class="collection-as-table">Activation Date</th>
          <th class="collection-as-table">Mail</th>
          <th class="collection-as-table">UR</th>
        </tr>
        </thead>
        <tbody>
        [...]
        </tbody>
      </table>

有什么见解、建议、教程、解释吗。。。?

谢谢你抽出时间。

看起来您正在加载Prototype,它覆盖了$。尝试删除其中一个或另一个,或者查看jQuery的noconflict模式。

来自链接:

var $j = jQuery.noConflict();
// $j is now an alias to the jQuery function; creating the new alias is optional.
$j(document).ready(function() {
    $j(".urTable" ).tablesorter();
});

相关内容

最新更新