473,503 Members | 3,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Alt Text problem

1 New Member
Greetings,

I have a photo gallery of about 4000 pics and am trying to get it to display an alt text for each image. I have tried the two following methods and get the same result with both, they only display the first 4 characters of the field.

My captions at like "2000 Ford Ranger Pickup" and the alt text only shows the year.

First piece of code I wrote:

Expand|Select|Wrap|Line Numbers
  1. response.write "<td width='410' align='center'><br><IMG SRC=/images/" & rsObj("Folder") & "/" & rsObj("FileName") & "   alt=" & rsObj("Caption") & "><br><br><b>" & rsObj("Caption") & "</b><br>"
Second was someone else's idea.

Expand|Select|Wrap|Line Numbers
  1. response.write "<td width='410' align='center'><br><IMG SRC=/images/" & rsObj("Folder") & "/" & rsObj("FileName") & "   alt=" & Server.HTMLEncode(rsObj("Caption")) & "><br><br><b>" & rsObj("Caption") & "</b><br>"
both give me the same result, anyone have any ideas?

Thanks

Doug
Aug 5 '08 #1
2 1194
DrBunchman
979 Recognized Expert Contributor
Hi Doug,

Welcome to Bytes.com! I hope you find the site useful. Please could you remember to wrap your code blocks with CODE tags as it makes your posts much easier to read. Please also don't post links to external websites in the technical forums. You should take a moment to read the Posting Guidelines.

What happens if you hard code the words in like this:
Expand|Select|Wrap|Line Numbers
  1.  alt="2000 Ford Ranger Pickup"
Does that display correctly? (obviously it's the same for all images but we're just testing here).

If so then the string being returned from the database must be getting truncated somehow - are there any string delimiters in rsObj("Caption") (e.g. ' or ") which might be cutting it short?

Dr B
Aug 6 '08 #2
jhardman
3,406 Recognized Expert Specialist
Doug,

also, what does
Expand|Select|Wrap|Line Numbers
  1. response.write server.htmlencode(rsObj("Caption"))
produce in code? My best guess is it isn't valid HTML - validating (validator.w3.org) is always a good idea if the code doesn't look how you expect.

Yes, there are other ways to write it. The following makes more sense to me if you need to write more than a little in the response.write:
Expand|Select|Wrap|Line Numbers
  1. %>
  2. <td width="410" align="center"><br><img src="/images/<%=rsObj("folder") & "/" & rsObj("FileName")%>" alt="<%=server.htmlEncode(rsObj("Caption"))%>">
  3. <br><br><b><%= rsObj("Caption")%></b><br>
  4. <%
Let me know if this helps.

Jared
Aug 6 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3721
by: Srinath Avadhanula | last post by:
Hello, Sorry to be bringing up what seems to be a somewhat beaten up topic... This is what I wanted to do: Create a _simple_ text editor widget which supports VI(M) style keybindings but...
19
5625
by: Svennglenn | last post by:
I'm working on a program that is supposed to save different information to text files. Because the program is in swedish i have to use unicode text for ÅÄÖ letters. When I run the following...
0
2404
by: Pierre Jelenc | last post by:
I have a blog script that is a customized version of Word Press (wordpress.org) at http://www.web-ho.com/blog/ Because of the way it evolved, some of the CSS may not be the best, I have tended...
5
4712
by: Harry | last post by:
CSS Description: Table contains a column of td cells with links. Achieved: 1. Entire link cells highlight when hovered. 2. The entire area of these cells are clickable. Problem:
12
8326
by: who be dat? | last post by:
I'm trying to make a webpage do the following: I want a user to be able to click on a given image (there will be more than one image). Upon clicking a given image, characters specific to that...
3
2867
by: Jan Krouwer | last post by:
I have a problem that shows up only on some systems - the toolbar text in buttons is not visible (vb.net 2003 app, 1.1 framework). As a workaround, I changed the textalign property to "right". This...
1
2383
by: svijay | last post by:
hi I have got a strange problem. May I know any solution for this. Here is the detailed description about the problem We have got a mainframe system and also production and development...
14
3958
by: Roger Withnell | last post by:
How to I find out what size text the browser is set to? Thanks in anticipation.
4
1294
by: Steven Bethard | last post by:
I have some plain text data and some SGML markup for that text that I need to align. (The SGML doesn't maintain the original whitespace, so I have to do some alignment; I can't just calculate the...
2
1670
by: DragonShade | last post by:
To be honest, I'm not sure if this is a .NET issue, some configuration on a PC, or a setting in a database but here goes: Environment (have NO control over): XP (London & Tokyo),.NET 2.0 C#, 2...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7064
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
7261
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,...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5559
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
4665
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
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
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.