Javascript命名空间和IE7问题 [英] Javascript namespace and problem with IE7

查看:119
本文介绍了Javascript命名空间和IE7问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我根据另一个堆栈溢出问题的答案实施了Javascript名称间隔解决方案:如何在JavaScript中声明名称空间?

I implemented a Javascript namespacing solution based on this answer to another stack overflow question: How do I declare a namespace in JavaScript?

我们称之为isigma-ns.js:

Let's call this isigma-ns.js:

var ISIGMA = {
  messages: {
    noValidId: "No valid ID found",
    reason: "Reason",
    // etc...
  },

  language: "ca",
  SIGN: 2,
  PAUSE: 400,
  params: {},

  init: function(params) {
    // etc...
  },

  delay: function(callback) {
    // etc...
  },

  // etc...

  signURL: function(cert, url) {
    // etc... 
  }
};

我将此脚本包括在我的页面中,以及其他内容:

I include this script in my page, plus other stuff:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>
    <title>Isigma Signature Widget</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>

    <!-- Required javascript and styles for isigma widget-->
    <script type="text/javascript" src="/isme/media/signwidget/jquery-1.4.4.min.js"></script>
    <script type="text/javascript" src="/isme/media/signwidget/isigma-ns.js"></script>
    <script type="text/javascript">
    $(function(){
        $("#applet").isigmaSignatureApplet({
            purpose: ISIGMA.SIGN,
            url: the_url,
            language: 'es'
        });
    });                                       
    </script>

...等等...

它在Firefox,IE8,Chrome,Opera中可以正常工作,但在IE7中失败,并显示消息未定义ISIGMA"-指的是我引用ISIGMA.SIGN的那一行.

It works fine in Firefox, IE8, Chrome, Opera... but fails in IE7 with the message "ISIGMA is not defined" - referring to the line where I make a reference to ISIGMA.SIGN.

关于这里可能出什么问题的任何提示? IE7对Javascript文件的处理顺序有什么问题吗?还有其他猜测吗?

Any hints about what can be wrong here? Is there anything wrong with IE7 processing order of Javascript files? Any other guess?

注意:要获得完整参考,整个程序都在 http://app中运行.portasigma.com/isme/signwidget/iframe/,并且名称空间JS文件实际上被命名为 http://app.portasigma.com/isme/media/signwidget/jquery-isigmaWidget.js

Note: for a full reference, the whole thing is running in http://app.portasigma.com/isme/signwidget/iframe/ and the namespace JS file is really named http://app.portasigma.com/isme/media/signwidget/jquery-isigmaWidget.js

推荐答案

它是原因"之后的逗号.请参阅: http://jsbin.com/upiba5/2/edit 在您的实时站点上,我看到的逗号后面是:

It is the comma after "Reason". See: http://jsbin.com/upiba5/2/edit on your live site, the extra comma I see is after:

documentLockedByAnother:此 文档当前被锁定 另一个用户,请稍后再试",

documentLockedByAnother: "This document is currently locked by another user, try again later",

  var ISIGMA = {
  messages: {
    noValidId: "No valid ID found",
    reason: "Reason"
    // etc...
  },

  language: "ca",
  SIGN: 2,
  PAUSE: 400,
  params: {},

  init: function(params) {
    // etc...
  },

  delay: function(callback) {
    // etc...
  },

  // etc...

  signURL: function(cert, url) {
    // etc... 
  }
};

这篇关于Javascript命名空间和IE7问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆