Alt Tags不适用于动态图像标记

时间:2015-01-14 05:50:34

标签: java html jsp jstl web-deployment

我正在使用动态图片。这意味着内部图片标签我使用动态链接为src和动态文本为alt.For src它工作正常,但在alt,我没有得到文本。这是一个例子我的img标签。

<img style="top: 0px !important;" data-frame="<%=thumb%>" src="<%=image%>" alt="<%= advertiseObj.getAdTitle() %>" />

1 个答案:

答案 0 :(得分:0)

现在已经解决了。由于javascript效应,我没有得到alt。

我正在使用那个img作为画廊框架。所以我正在通过jquery为该画廊设置一个框架。所以这是我的旧代码。

(function ($) {
// custom image object
var gvImage = function (img) {

    this.src = { 
        panel: img.attr('src'),
        frame: img.data('frame') || img.attr('src')
    };
    this.scale = {
        panel: null,
        frame: null
    };
    this.height = 0;
    this.width = 0;
    this.attrs = {
        title: img.attr('title') || img.attr('alt'),
        description: img.data('description')
    };
    this.href = null;
    this.dom_obj = null;

    return this;
},

我为alt添加了一些东西。它只是一个命中和踪迹。但它对我有用。这是我的新代码。

(function ($) {
// custom image object
var gvImage = function (img) {

    this.src = { 
        panel: img.attr('src'),
        frame: img.data('frame') || img.attr('src')
    };
    this.alt = { 
            panel: img.attr('alt'),
            frame: img.attr('alt')
        };
    this.scale = {
        panel: null,
        frame: null
    };
    this.height = 0;
    this.width = 0;
    this.attrs = {
        title: img.attr('title') || img.attr('alt'),
        description: img.data('description')
    };
    this.href = null;
    this.dom_obj = null;

    return this;
},
相关问题