I nee开发者_如何转开发d to list images from the server. The problem is that, first image needs to be in different div. I dont know what I do wrong here. The following code lists images as;
1.jpg1.jpg 2.jpg 3.jpg
but it needs to list as;
1.jpg2.jpg 3.jpg
<div id="main">
<a href="<%=IMAGES(0)%>" title="<%=objProduct("PRODUCTNAME")%>"><img src="<%=IMAGES(0)%>" alt="<%=objProduct("PRODUCTNAME")%>" id="productimage" /></a>
<%
i = 0
For Each IMAGE In IMAGES
i = i + 1
%>
<a href="<%=IMAGE%>" title="<%=objProduct("PRODUCTNAME")%>"></a>
<%
Next
%>
</div>
<%
i = 0
For Each IMAGE In IMAGES
i = i + 1
if (i > 1) then
%>
<a href="<%=IMAGE%>" title="<%=objProduct("PRODUCTNAME")%>"></a>
<%
end if
Next
%>
The point is that first you correctly create the first div. But then you use for each loop, and it will always iterate over all images. Thus doing the first image twice. You can solve this in many different ways, one would be to use While loop for image 2 - n, another would be to have an if statement checking if it is the first image.
精彩评论