javascript - 语法错误? Jquery 脚本在 IE7 中不起作用

标签 javascript jquery syntax internet-explorer-7

我使用以下代码在单击按钮时打开模式框。在所有浏览器中工作正常,但在 IE7 中我收到错误。

这是代码。我是不是做错了什么???

            <script type="text/javascript">
$(document).ready(function(){
var dialogOpts = {
      modal: true,
      bgiframe: true,
      autoOpen: false,
      height: 550,
      width: 550,
      draggable: true,
      resizeable: true,
      title: "Invite a friend",
   };
$("#invitebox").dialog(dialogOpts);   //end dialog

   $('#invitebutton').click(
      function() {
         $("#invitebox").load("widgets/invite_a_friend/index.php", [], function(){
               $("#invitebox").dialog("open");
            }
         );
         return false;
      }
   );
}); 
</script>

最佳答案

删除title后面的,:

var dialogOpts = {
      modal: true,
      bgiframe: true,
      autoOpen: false,
      height: 550,
      width: 550,
      draggable: true,
      resizeable: true,
      title: "Invite a friend", // <-- REMOVE THIS COMMA
   };

还有.load()函数接受一个对象而不是数组作为第二个参数:

$("#invitebox").load("widgets/invite_a_friend/index.php", { }, function() {
    $("#invitebox").dialog("open");
});

关于javascript - 语法错误? Jquery 脚本在 IE7 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3849195/

相关文章:

javascript - 在javascript中将文本添加到SVG文档

javascript - Ckeditor appendTo 无法识别配置

javascript - 如何在 javascript 中过滤 2 个列表之间的项目?

php - 更好地在表单提交按钮上使用jquery?

php - 向不同目的地提交两次表格

javascript - 悬停时更改 div 内的图片(带边框)

javascript - 限制日期选择器日期

MySQL - 当进入只有外键的表时插入语句失败

python - 是我的人工编译器 : What is wrong with this Python 2. 5 代码吗?

javascript - JavaScript 的完整铁路/语法图