By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

asp code does not render for first record in looped recordset

P: n/a
I have posted this question on a javascript forum as it contains
javascript code however it was believed to be an asp issue.

The following head section javascript code contains the function
showBigImage( isource,bigImage,header ) function call of discussion:

var currentImage;
function showBigImage( isource,bigImage,header ) {
var theImage = document.getElementById( 'largeimage' );
theImage.src = isource;
currentImage = bigImage;
document.getElementById( 'photoHeader' ).innerHTML=header;
document.getElementById( 'largeimage' ).alt=header;

The following rendered looped recordset code illustrates how the
"header" parameter of this showBigImage( isource,bigImage,header )
function call does not render ONLY FOR THE FIRST RECORD OF THE
RECORDSET as it is blank:

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/portable_stage.jpg&width=250','images/
portable_stage.jpg','' )"<img src="imagescript.asp?path=images/
portable_stage.jpg&width=36" border="0" alt="" /</td</a>

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/seated_riserset.jpg&width=250','images/
seated_riserset.jpg','Portable stage configuration using 9 units of
the 3 ft x 8 ft platforms in 3 different heights' )"<img
src="imagescript.asp?path=images/seated_riserset.jpg&width=36"
border="0" alt="" /</td</a>

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/Stageset.jpg&width=250','images/Stageset.jpg','Portable
stage configuration using 16 units of the 4 ft x 8 ft platforms' )">
<img src="imagescript.asp?path=images/Stageset.jpg&width=36"
border="0" alt="" /</td</a>

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/Runset.jpg&width=250','images/Runset.jpg','Portable stage
runset configuration' )"<img src="imagescript.asp?path=images/
Runset.jpg&width=36" border="0" alt="" /</td</a>
Because of this problem, the caption text does not display for this
first image record once the thumbnail images are moused over. You can
view this page example at
http://www.canchair.com/new_web_prod...ctFamilySub=10
Jul 22 '08 #1
Share this Question
Share on Google+
16 Replies


P: n/a
wrote on 22 jul 2008 in microsoft.public.inetserver.asp.general:
I have posted this question on a javascript forum as it contains
javascript code however it was believed to be an asp issue.
There is no ASP code in the below.
The following head section javascript code contains the function
showBigImage( isource,bigImage,header ) function call of discussion:

var currentImage;
function showBigImage( isource,bigImage,header ) {
var theImage = document.getElementById( 'largeimage' );
theImage.src = isource;
currentImage = bigImage;
document.getElementById( 'photoHeader' ).innerHTML=header;
document.getElementById( 'largeimage' ).alt=header;
This is clientside code, so you are off topic.
The following rendered looped recordset code illustrates how the
"header" parameter of this showBigImage( isource,bigImage,header )
function call does not render ONLY FOR THE FIRST RECORD OF THE
RECORDSET as it is blank:

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/portable_stage.jpg&width=250','images/
portable_stage.jpg','' )"<img src="imagescript.asp?path=images/
portable_stage.jpg&width=36" border="0" alt="" /</td</a>

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/seated_riserset.jpg&width=250','images/
seated_riserset.jpg','Portable stage configuration using 9 units of
the 3 ft x 8 ft platforms in 3 different heights' )"<img
src="imagescript.asp?path=images/seated_riserset.jpg&width=36"
border="0" alt="" /</td</a>

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/Stageset.jpg&width=250','images/Stageset.jpg','Portable
stage configuration using 16 units of the 4 ft x 8 ft platforms' )">
<img src="imagescript.asp?path=images/Stageset.jpg&width=36"
border="0" alt="" /</td</a>

<a href= "javascript:;" <td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?
path=images/Runset.jpg&width=250','images/Runset.jpg','Portable stage
runset configuration' )"<img src="imagescript.asp?path=images/
Runset.jpg&width=36" border="0" alt="" /</td</a>
Because of this problem, the caption text does not display for this
first image record once the thumbnail images are moused over. You can
view this page example at
http://www.canchair.com/new_web_prod...tID=198&Produc
tFamily=1&ProductFamilySub=10


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 22 '08 #2

P: n/a
ha**@canchair.com wrote:
I have posted this question on a javascript forum as it contains
javascript code however it was believed to be an asp issue.
Given that there is no server-side code shown here, I'm not sure what
led whoever it was to believe that this was an ASP issue.

If it is an asp issue then we have no chance of debugging it without
seeing the server-side code contained in ...imagescript.asp
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '08 #3

P: n/a
On Jul 22, 4:24*pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
h...@canchair.com wrote:
I have posted this question on a javascript forum as it contains
javascript code however it was believed to be an asp issue.

Given that there is no server-side code shown here, I'm not sure what
led whoever it was to believe that this was an ASP issue.

If it is an asp issue then we have no chance of debugging it without
seeing the server-side code contained in ...imagescript.asp
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
You are absolutely right. I should've posted the asp code and here it
is:

<a href= "javascript:;" class="small_img" >
<td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?path=<%=
images.Fields.Item( "url_img" ).Value %>&width=250','<%=
images.Fields.Item( "url_img" ).Value %>','<
%=(images.Fields.Item("alt_img").Value)%>' )"><img
src="imagescript.asp?path=<%= images.Fields.Item( "url_img" ).Value
%>&width=36" border="0" alt="" /</td>
</a>
Jul 23 '08 #4

P: n/a
wrote on 23 jul 2008 in microsoft.public.inetserver.asp.general:
On Jul 22, 4:24*pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
>h...@canchair.com wrote:
I have posted this question on a javascript forum as it contains
javascript code however it was believed to be an asp issue.

Given that there is no server-side code shown here, I'm not sure what
led whoever it was to believe that this was an ASP issue.

If it is an asp issue then we have no chance of debugging it without
seeing the server-side code contained in ...imagescript.asp
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get
a quicker response by posting to the newsgroup.

You are absolutely right. I should've posted the asp code and here it
is:

<a href= "javascript:;" class="small_img" >
<td height=36 valign="middle"
class="small_img" onmouseover="showBigImage(
'imagescript.asp?path=<%images.Fields.Item( "url_img" ).Value
%>&width=250','<%images.Fields.Item( "url_img" ).Value %>','<
%=(images.Fields.Item("alt_img").Value)%>' )"><img
src="imagescript.asp?path=<%= images.Fields.Item( "url_img" ).Value
%>&width=36" border="0" alt="" /</td>
</a>
If the ASP string is correct, even then this:

<%images.Fields.Item( "url_img" ).Value %>

will not do in ASP, or render to the html-string, anything,
so perhaps you want to try:

<% = images.Fields.Item( "url_img" ).Value %>

[etc.]

However,
since you do not show the relevant serverside database access code,
or even what database you use,
I cannot say.

And we do not know if imagescript.asp will process the querystring value
correctly

And if the resultstring of
<% = images.Fields.Item( "url_img" ).Value %>
is encoded to precvent it to have characters that break the querystring,
[like an apostrophe].

Even the html is wrong:
<td .... /></td>
[why the /?]
and
<a ...><td .... /></td>...</a>
is wrong,
and
<a href= "javascript:;" class="small_img" >
is questionable,
but that all is off topic on this NG.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '08 #5

P: n/a
ha**@canchair.com wrote:
On Jul 22, 4:24 pm, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
>h...@canchair.com wrote:
>>I have posted this question on a javascript forum as it contains
javascript code however it was believed to be an asp issue.

Given that there is no server-side code shown here, I'm not sure what
led whoever it was to believe that this was an ASP issue.

If it is an asp issue then we have no chance of debugging it without
seeing the server-side code contained in ...imagescript.asp

You are absolutely right. I should've posted the asp code and here it
is:

<a href= "javascript:;" class="small_img" >
<td height=36 valign="middle"
class="small_img" onmouseover="showBigImage( 'imagescript.asp?path=<%=
images.Fields.Item( "url_img" ).Value %>&width=250','<%=
images.Fields.Item( "url_img" ).Value %>','<
%=(images.Fields.Item("alt_img").Value)%>' )"><img
src="imagescript.asp?path=<%= images.Fields.Item( "url_img" ).Value
%>&width=36" border="0" alt="" /</td>
</a>
Err ... that is not the code contained in imagescript.asp is it? No mention
of a recordset, for one thing ...

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 23 '08 #6

P: n/a
i really appreciate the responses.
the imagescript page is the page that resizes the images but i have no
issues with the images but rather the alt_img database field not
rendering properly for the initial recordset value.

and database type is Access.
imagescript.asp code:

<%
Response.Expires = 0
' create instance of AspJpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")

If Request.QueryString("width")=36 Then
Jpeg.New 36, 36, &HFFFFFF
Else
Jpeg.New 250, 250, &HFFFFFF
End If

' Open source file
Jpeg.Open Server.MapPath(Request.QueryString("path"))

'Jpeg.Width = Request("Width")

L = Request("Width")

'Jpeg.Height = Jpeg.OriginalHeight * Jpeg.Width / Jpeg.OriginalWidth

If jpeg.OriginalWidth jpeg.OriginalHeight Then
jpeg.Width = L
jpeg.Height = jpeg.OriginalHeight * L / jpeg.OriginalWidth
Else
jpeg.Height = L
jpeg.Width = jpeg.OriginalWidth * L / jpeg.OriginalHeight
End If

' Perform resizing and
' send resultant image to client browser
Jpeg.SendBinary

%>
Jul 23 '08 #7

P: n/a
This is the code to narrow in on:

onmouseover="showBigImage( 'imagescript.asp?path=<%=
images.Fields.Item( "url_img" ).Value %>&width=250','<%=
images.Fields.Item( "url_img" ).Value %>','<
%=(images.Fields.Item("alt_img").Value)%>' )">

This '<%=(images.Fields.Item("alt_img").Value)%>' portion of the code
is what is not rendering for the initial image of the recordset
Jul 23 '08 #8

P: n/a
ha**@canchair.com wrote:
i really appreciate the responses.
the imagescript page is the page that resizes the images but i have no
issues with the images but rather the alt_img database field not
rendering properly for the initial recordset value.
So I guess I still don't understand the suspicion that this is an
ASP/server-side code problem.
>
and database type is Access.
imagescript.asp code:
<snip>
Still no mention of a recordset ... ?
I don't know how we can help.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 23 '08 #9

P: n/a
ha**@canchair.com wrote:
This is the code to narrow in on:

onmouseover="showBigImage( 'imagescript.asp?path=<%=
images.Fields.Item( "url_img" ).Value %>&width=250','<%=
images.Fields.Item( "url_img" ).Value %>','<
%=(images.Fields.Item("alt_img").Value)%>' )">

This '<%=(images.Fields.Item("alt_img").Value)%>' portion of the code
is what is not rendering for the initial image of the recordset
No it isn't. There is no mention of a recordset here, unless images is a
recordset object. If so, we need to see the code used to open the
recordset (and its connection) as well as a description of the database
table (field datatypes and names), along with the code used to navigate
to the record whose alt_img field you wish to display. Try to slice out
as much html as possible so we can focus on the server-side ADO code.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 23 '08 #10

P: n/a
ha**@canchair.com wrote on Wed, 23 Jul 2008 07:45:54 -0700 (PDT):
This is the code to narrow in on:
onmouseover="showBigImage( 'imagescript.asp?path=<%=
images.Fields.Item( "url_img" ).Value %>&width=250','<%=
images.Fields.Item( "url_img" ).Value %>','<
%=(images.Fields.Item("alt_img").Value)%>' )">
This '<%=(images.Fields.Item("alt_img").Value)%>' portion of the code
is what is not rendering for the initial image of the recordset

Silly question, but are you sure the value of alt_img for that row in the
database actually has a value?

And another thing to consider (which shouldn't affect this though) is that
you should ensure that there is no way to get an apostrophe into your
database, or if you do allow it that you ensure that you escape it (ie store
it as \') or else you risk breaking the javascript handling in the client
(or even worse potentially allowing cross-site scripting).

--
Dan
Jul 23 '08 #11

P: n/a
Not sure why some posters thought this had anything to do with JS and nothing
to do with recordset.

I certainly don't know anything other than a recordset object that uses the
code pattern
[name].Field.Item('...fieldname...").Value

Now, it's also true that DumbWeaver is plunking in way too much code there.

The expression
<% = images.Fields.Item( "url_img" ).Value %>
is 100% equivalent to the easier-to-write, easier-to-read, and MEASURABLY
FASTER
<%=images("url_img")%>
And I do recommend that you switch to that.

***************

Having said all that.

I see no reason at all in any of your code that the first description
doesn't show up in the output. (And it's clearly nothing to do with
apostrophes...a VIEW-->>SOURCE of the HTML of your page shows that there is
NOTHING WHATSOEVER there.)

So I have to question your actual database. Are you 100% *SURE* that you
actually *HAVE* any text in the
alt_img
field for that given
url_img
value????

In other words, go into your Access database (using Access, not using ASP,
not using DumbWaster) and find the record where
url_img
is
images/portable_stage.jpg
Then, *IN THAT SAME RECORD*, find what the value of
alt_img
is. I am personally betting that the value is blank. And so you are
getting exactly what you should.

**********************

I do note that your code isn't *REALLY* doing what it *SHOULD* be doing.

You said to look at the URL
http://www.canchair.com/new_web_prod...ctFamilySub=10

I did. I also looked at
ProductID=111
and
ProductFamilySub=12
and tried various other combinations. And I still got the same images, no
matter what.

So given all that, maybe it's not surprising that the DB doesn't have a
value in one field when you think it should.

*************************************

By the not so insignifcant by...your HTML code is ILLEGAL. It is rendering
thus:

<a href= "javascript:;" class="small_img" >
<td height=36 valign="middle" class="small_img"
onmouseover="showBigImage(
'imagescript.asp?path=images/portable_stage.jpg&width=250','images/portable_stage.jpg',''
)"><img src="imagescript.asp?path=images/portable_stage.jpg&width=36"
border="0" alt="" </td>
</a>
But it's illegal to have <A>...</Atags *OUTSIDE* of the <TD>...</TDtags.

As it turns out, MSIE is sloppy and allows this. Don't count on other
browser to do so.

Of course, the bigger question is a simple one: What's the point of the <A>
tag there, in the first place????? It is doing EXACTLY NOTHING. I would
string recommend removing the <Aand </Atags.

Jul 23 '08 #12

P: n/a
Old Pedant wrote:
Not sure why some posters thought this had anything to do with JS and
nothing
to do with recordset.
If you're asking why I missed it, the answer is simple: I do not expect to
see a recordset object named "images". Even if I had, I still had not seen
enough to decide where the problem was.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 23 '08 #13

P: n/a
"Bob Barrows [MVP]" wrote:
If you're asking why I missed it, the answer is simple: I do not expect to
see a recordset object named "images".
I thought you weren't only one that missed that. I thought a couple of
other posters did.

But no matter. It's obvious you haven't had to work with the junk that DW
produces as much as I have. I recognized its patterns (even its BigImage
stuff) right off. I think, all in all, you should consider yourself very
fortunate. <grin/>

[I admit, I tend to go overboard, ragging on DreamWeaver, but sheesh!
They've been producing the same crappy code since 1998 or so. I'm sure
nobody is doing any active work on improving it, today, but you'd think that
SOMEBODY would have changed SOME of their idiocies back in 2000 through 2002
or so.]


Even if I had, I still had not seen
enough to decide where the problem was.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 24 '08 #14

P: n/a
Old Pedant wrote:
[I admit, I tend to go overboard, ragging on DreamWeaver, but sheesh!
They've been producing the same crappy code since 1998 or so. I'm sure
nobody is doing any active work on improving it, today, but you'd think that
SOMEBODY would have changed SOME of their idiocies back in 2000 through 2002
or so.]
Dreamweaver CS4 is in public beta, all they did was break the UI and
improve the CSS abilities. The server side code hasn't changed since DW8
where they introduced paramatised commands to help prevent SQL injection.

Dreamweaver users have been screaming out for improved server side code
support for many years. Due to the poor support of server side code, and
regular browsing of this newsgroup, I have improved my asp/vbscript
coding abilities, but still use Dreamweaver to "design" my web applications.

Steve
Jul 24 '08 #15

P: n/a


"Dooza" wrote:
Dreamweaver users have been screaming out for improved server side code
support for many years. Due to the poor support of server side code, and
regular browsing of this newsgroup, I have improved my asp/vbscript
coding abilities, but still use Dreamweaver to "design" my web applications.
A smart person, you are. The dozen or so people who I've taken "in hand" do
pretty much the same thing: Do the HTML design with DW but then do all the
ASP coding (or at least much of it) by hand.

If nothing else, the amount of "kruft" that you get rid of that way makes
your pages run twice as fast.

[I don't do much HTML "design", and what I do is done with notepad or VS
2003, even when coding in ASP. I'm lucky in that I get to be the "backend"
to designers' front-ends.]
Jul 24 '08 #16

P: n/a
Old Pedant wrote:
>
"Dooza" wrote:
>Dreamweaver users have been screaming out for improved server side code
support for many years. Due to the poor support of server side code, and
regular browsing of this newsgroup, I have improved my asp/vbscript
coding abilities, but still use Dreamweaver to "design" my web applications.

A smart person, you are. The dozen or so people who I've taken "in hand" do
pretty much the same thing: Do the HTML design with DW but then do all the
ASP coding (or at least much of it) by hand.
I recently found out that Stored Procedures can output more than 1
recordset, and that you can easily step to the next one in ASP/VBScript.
This is something Dreamweaver will never do, yet it can save you
making several trips to the database. Since I do everything I can with
Stored Procedures to keep my database as secure as possible, this is a
great trick to use.
If nothing else, the amount of "kruft" that you get rid of that way makes
your pages run twice as fast.

[I don't do much HTML "design", and what I do is done with notepad or VS
2003, even when coding in ASP. I'm lucky in that I get to be the "backend"
to designers' front-ends.]
I have always been a visual designer. One of my early jobs in tech
support was for HoTMetaL Pro. The only way to support a package like
that was to learn what it was trying to do. I soon found it was bloody
awful at making good code! So I bought a book, Web Master in a Nutshell,
and started to dabble. When I found Dreamweaver 2 it appeared to make
better code, and let me be more creative whilst still letting me take
control of the code... haven't looked back since then, and have made a
nice living from it so far, always learning on the way.

Steve
Jul 25 '08 #17

This discussion thread is closed

Replies have been disabled for this discussion.