0

我正在做一个用户控制,我想使用一些像这样使用的图像:

    // 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 的错误相同)

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

我在这里想念什么?

编辑:

在此处输入图像描述

在此处输入图像描述

编辑2:

在此处输入图像描述

4

1 回答 1

1

当心!图像的路径是 Test1\shapes\bb.png。您缺少“Test1”。

例如: 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");
于 2014-08-23T00:01:06.577 回答