在用户控件中使用png时出错

时间:2014-08-22 17:01:10

标签: javascript user-controls genexus

我正在进行用户控制,我想使用一些我使用的图像:

    // image loader
    var imageURLs = [];
    var imagesOK = 0;
    var imgs = [];
    imageURLs.push("shapes/isit.png");
    imageURLs.push("shapes/ec.png");
    imageURLs.push("shapes/bc.png");
    imageURLs.push("shapes/bb.png");
    imageURLs.push("shapes/io.png");
    loadAllImages();

    function loadAllImages() {
      for (var i = 0; i < imageURLs.length; i++) {
        var img = new Image();
        imgs.push(img);
        img.onload = function () {
          imagesOK++;
          if (imagesOK == imageURLs.length) {
            start();
          }
        };
        img.id = i;
        img.src = imageURLs[i];
      }
    }

此代码在show方法中。

但我有这个错误:

Uncaught SyntaxError: Unexpected token ILLEGAL                          isit.png:1

(每个png的错误相同)

我已经检查过图像是否在知识库目录中,并且它们是。

在那次错误之后我也有这个错误:

GET http://trialapps3.genexus.com/Id899a095c574c049b25f760a574de3016/shapes/isit.png 404 (Not Found)         Test1Render.js:92

(每个png的错误相同)

但我认为这个错误是以前错误的结果。

我在这里缺少什么?

修改

enter image description here

enter image description here

EDIT2:

enter image description here

1 个答案:

答案 0 :(得分:1)

小心! 图像的路径是Test1 \ shapes \ bb.png。 你错过了&#34; Test1&#34;。

例: http://trialapps3.genexus.com/Id899a095c574c049b25f760a574de3016/test1/shapes/isit.png

imageURLs.push("test1/shapes/isit.png");
imageURLs.push("test1/shapes/ec.png");
imageURLs.push("test1/shapes/bc.png");