473,499 Members | 1,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image Reference

Hi

I have a page and at the top of which I am defining some images as follows:

<%
img_1 = "images\image1.gif"
img_2 = "images\image2.gif"
%>

and so on but with more complex filenames.

Further on in the code, I want to reference this image in an <IMG> tag.
Usually I would go src=<%=img_1%>, but in this case I am using a loop, e.g.
<%For x=1 To 7%>

Is there anyway to combine the number of the loop with "img_" to give me
something like "img_1", "img_2" and so on depending on the position in the
loop.

I can join the two so it looks for an image with that name but I need use
this string to reference the image defined at the top of the page.

Regards, Carl Gilbert
Nov 19 '05 #1
1 918
Carl,
Are you using ASP or ASP.Net? If you are doing ASP, you can do something
like:
<%
img = "images/img_{ID}.gif"
%>

<% for x = 1 to 7 %>
<img src="<%=Replace(img, "{ID}", x)%>">
<% next %>

If you are doing this in ASP.Net, you are way off on how you should be
programming.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Carl Gilbert" <mr*************@hotmail.com> wrote in message
news:%S***************@newsfe2-win.ntli.net...
Hi

I have a page and at the top of which I am defining some images as follows:
<%
img_1 = "images\image1.gif"
img_2 = "images\image2.gif"
%>

and so on but with more complex filenames.

Further on in the code, I want to reference this image in an <IMG> tag.
Usually I would go src=<%=img_1%>, but in this case I am using a loop, e.g. <%For x=1 To 7%>

Is there anyway to combine the number of the loop with "img_" to give me
something like "img_1", "img_2" and so on depending on the position in the
loop.

I can join the two so it looks for an image with that name but I need use
this string to reference the image defined at the top of the page.

Regards, Carl Gilbert

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2590
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical)...
6
3503
by: Olly | last post by:
I've found a basic script, however I also need to add alt and title attributes as well, how would I go about doing this? Here's the script I found: Thanks <script language="JavaScript"> <!--...
1
2042
by: John | last post by:
I am rotating images of different dimensions. My problem is that when a new image is displayed in a new position which had an image of a different dimension, the old image is first stretched to the...
3
3360
by: Becky Carter Hickman-Jones | last post by:
Hi, I have a simple script that opens an image in a new window which is sized to the image. The script is as follows: <a title="xxx"...
12
6161
by: Sharon | last post by:
I’m wrote a small DLL that used the FreeImage.DLL (that can be found at http://www.codeproject.com/bitmap/graphicsuite.asp). I also wrote a small console application in C++ (unmanaged) that uses...
15
5298
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
3
4112
by: Fuzzyman | last post by:
Hello all, I'm using a website creation tool (called `rest2web <http://www.voidspace.org.uk/python/rest2web/>`_) that lets me store my content in a text based format ( `ReStructuredText...
3
26737
by: jon | last post by:
Hello, I've had long standing code that runs in IE, that I'm testing with firefox unsuccessfully now. The problem seems to be that images that I dynamically create don't fire their onload event...
6
7212
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to...
2
3534
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7171
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5468
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
664
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.