我使用了图像数组具有静态图像的脚本。
我想通过查找存储在隐藏字段中的index.aspx.cs文件中的图像名称来动态转换它。
我的hiddenfileds有价值:
上传/../上传/ M_Banner_3-JO633939707781250000.jpg;上传/../上传/ M_Banner_4-JO634014944056581250.jpg;上传/../上传/ M_Banner_2-I-85634067544720151968.jpg;上传/../上传/M_Banner_1-Plan634067543966714468.jpg
我想拆分这个隐藏的文件并将其分配给imagearray。我可以这样做吗
var mygallery2=new fadeSlideShow({
wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
dimensions: [568, 313], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
["images/1.jpg", "", "", ""],
["images/2.jpg", "", "", ""],
["images/3.jpg"],
["images/4.jpg", "", "", ""] //<--no trailing comma after very last image element!
],
displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
descreveal: "always",
togglerid: "fadeshow2toggler"
})
答案 0 :(得分:0)
var s = "uploads/../uploads/M_Banner_3-JO633939707781250000.jpg;uploads/../uploads/M_Banner_4-JO634014944056581250.jpg;uploads/../uploads/M_Banner_2-I-85634067544720151968.jpg;uploads/../uploads/M_Banner_1-Plan634067543966714468.jpg";
var imagearray = s.split(';');
for (var i=0; i<imagearray.length; i++) {
imagearray[i] = [imagearray[i], "", "", ""];
}
答案 1 :(得分:0)
假设您有单独的隐藏输入框,每个图像都有唯一的ID
imagearray: [
[$("#a1").val(), "", "", ""],
[$("#a2").val(), "", "", ""],
[$("#a3").val()],
[$("#a4").val(), "", "", ""] //<--no trailing comma after very last image element!
]