Jquery语法错误但未突出显示

时间:2012-01-04 11:31:13

标签: php jquery head

嗨我好像在这个脚本的最后一行在Dreamweaver中出现错误,它已经出现了,因为我在头部添加了一些Jquery初始化代码,但我似乎无法看到错误实际上是根据Dreamweaver关闭脚本标记是错误。

<script src="./ui/media/js/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="./ui/media/js/jquery.dataTables.min.js"     type="text/javascript"></script>

<script src="./ui/media/js/ZeroClipboard.js" type="text/javascript"></script>

<script src="./ui/media/js/TableTools.js" type="text/javascript"></script>

<!-- TinyMCE -->
<script type="text/javascript" src="./jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    editor_selector : "mceSimple"
});

tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    editor_selector : "mceAdvanced",
    theme_advanced_buttons1 :     "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink,Name,Rep,Date",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    plugins : 'inlinepopups',
    setup : function(ed) {
        // Add a custom button
        ed.addButton('Name', {
            title : '[Name]',
            class : 'namebutton',
            image : 'img/example.gif',
            onclick : function() {
                // Add you own code to execute something on click
                ed.focus();
                ed.selection.setContent('{name}');
            }

        });

        ed.addButton('Rep', {
            title : '[Rep]',
            class : 'repbutton',
            image : 'img/example.gif',
            onclick : function() {
                // Add you own code to execute something on click
                ed.focus();
                ed.selection.setContent('{createdby}');
            }
        });

        ed.addButton('Date', {
            title : '[Date]',
            class : 'datebutton',
            image : 'img/example.gif',
            onclick : function() {
                // Add you own code to execute something on click
                ed.focus();
                ed.selection.setContent('{datesent}');
            }
        });
</script>

<!-- /TinyMCE -->






<script src="./ui/media/js/jquery-ui-1.8.16.custom.min.js"     type="text/javascript"></script>



<script type="text/javascript">
$(document).ready( function() {
    $('#dashboard').dataTable({
        "bJQueryUI": true,
        "bInfo": true,
        "bAutoWidth": true,
        "bFilter": true,
        "bLengthChange": true,
        "bPaginate": true,
        "bProcessing": true,
        "bSort": true,
        "sPaginationType": "full_numbers",
        "aaSorting": [[ 6, "desc" ]],
        "iDisplayLength": 5,
        "bLengthChange": false   
    });
});
</script>

3 个答案:

答案 0 :(得分:2)

您不能使用不带引号的单词 class ,因为它是保留关键字。 此外,tinyMCE.init末尾有两个缺少右括号和一个右括号。

答案 1 :(得分:1)

您在微小的mce代码中缺少两个结束括号来关闭tinyMCE.initsetup: function(ed) {

<script type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "simple",
    editor_selector : "mceSimple"
});

tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    editor_selector : "mceAdvanced",
theme_advanced_buttons1 :     "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,     justifyfull,bullist,numlist,undo,redo,link,unlink,Name,Rep,Date",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
plugins : 'inlinepopups',
setup : function(ed) {
    // Add a custom button
    ed.addButton('Name', {
        title : '[Name]',
        class : 'namebutton',
        image : 'img/example.gif',
        onclick : function() {
            // Add you own code to execute something on click
            ed.focus();
            ed.selection.setContent('{name}');
        }

    });
      ed.addButton('Rep', {
        title : '[Rep]',
        class : 'repbutton',
        image : 'img/example.gif',
        onclick : function() {
            // Add you own code to execute something on click
            ed.focus();
            ed.selection.setContent('{createdby}');
        }

    });
     ed.addButton('Date', {
        title : '[Date]',
        class : 'datebutton',
        image : 'img/example.gif',
        onclick : function() {
            // Add you own code to execute something on click
            ed.focus();
            ed.selection.setContent('{datesent}');
        }

    });
  }
});
   </script>

   <!-- /TinyMCE -->

答案 2 :(得分:0)

您在tinymce区块中遗漏了几个右括号。试试这个:

tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    editor_selector : "mceAdvanced",
    theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,undo,redo,link,unlink,Name,Rep,Date",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    plugins : 'inlinepopups',
    setup : function(ed) {
        // Add a custom button
        ed.addButton('Name', {
            title : '[Name]',
            class : 'namebutton',
            image : 'img/example.gif',
            onclick : function() {
                // Add you own code to execute something on click
                ed.focus();
                ed.selection.setContent('{name}');
            }
        });

        ed.addButton('Rep', {
            title : '[Rep]',
            class : 'repbutton',
            image : 'img/example.gif',
            onclick : function() {
                // Add you own code to execute something on click
                ed.focus();
                ed.selection.setContent('{createdby}');
            }
        });

         ed.addButton('Date', {
            title : '[Date]',
            class : 'datebutton',
            image : 'img/example.gif',
            onclick : function() {
                // Add you own code to execute something on click
                ed.focus();
                ed.selection.setContent('{datesent}');
            }
        });
    }
});