Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update form text box

Status
Not open for further replies.

ekwstats

MIS
Feb 2, 2004
70
US
I have a page that displays imgMain and then a bunch of thumbnails. When the user clicks on the thumbnail, I want the imgMain to change to the image the user clicked on, and the text below it to reflect the pictures description. This works fine as long as there is a valid description. If there isn't, the image is opened by itself on a blank page.

Here is the code I am using.
Works as long as there is a value...
<a href=""/db/listimages/" & oRS.Fields(21).Value & """ onclick=""document.images.imgMain.src=this.href;document.PhotoDescrip.txtPhotoDescrip.value ='"& oRS.Fields(35).Value & "';return false;""><IMG border=""0"" width=""114"" border=""0"" src=""db/listimages/" & oRS.Fields(21).Value & """></a>
Does not work and simulates there not being a value...
<a href=""/db/listimages/" & oRS.Fields(21).Value & """ onclick=""document.images.imgMain.src=this.href;document.PhotoDescrip.txtPhotoDescrip.value ='';return false;""><IMG border=""0"" width=""114"" border=""0"" src=""db/listimages/" & oRS.Fields(21).Value & """></a>

What am I doing wrong?
 
As far as I can see, there is nothing that should stop it working. However, I get the feeling you haven't given us all the code that is surrounding the A tag...

Are you writing the lines out dynamically? How are you writing them out? Is your string delimiter single or double quotes? Does your value get quotes (single or double) preprended and appended to it automatically by the page (is it VB?).

Can you show us the complete code surrounding the A tag (i.e. how it is written to the page), and not just a partial, cut-down version? I think it may help to debug this issue. And just as a hunch, what happens if you try this:

Code:
<a href=""/db/listimages/" & oRS.Fields(21).Value & """ onclick=""document.images.imgMain.src=this.href;document.PhotoDescrip.txtPhotoDescrip.value ='\'\'';return false;""><IMG border=""0"" width=""114"" border=""0"" src=""db/listimages/" & oRS.Fields(21).Value & """></a>

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top