Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 28th, 2008, 09:48 AM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default onmouseover question???

Hi to all...

I have this code in my page and its working...
my connection to my DB is working and its returning my info...
The problem is for each mouse over effect it has the same info for each one...

How can i store the info for each one...

Thanking you in advance...
Rino

<%
Set rs = connHartStores.Execute("sp_GetAllMerchandise")

Response.Write "<a onMouseover=" & Chr(34) & "Linens.src='/Hart/Merchandise/Images/Linens/LinS01.jpg';MainLinens.src='/Hart/Merchandise/Images/Linens/LinB01.jpg';DisplayDesc('" & rs("DescEng") &"');DisplaySKU('" & rs("SKU") &"');DisplayRetail('" & rs("Retail") &"');" & Chr(34) & ">" & Chr(13)
                                     Response.Write "<img src=" & Chr(34) & "/Hart/Merchandise/Images/Linens/LinS01.jpg" & Chr(34) & " border=" & Chr(34) & "1" & Chr(34) & " name=" & Chr(34) & "Linens" & Chr(34) & " width=" & Chr(34) & "100" & Chr(34) & " height=" & Chr(34) & "74" & Chr(34) & "></a><br>" & Chr(13)

Response.Write "<a onMouseover=" & Chr(34) & "Linens.src='/Hart/Merchandise/Images/Linens/LinS02.jpg';MainLinens.src='/Hart/Merchandise/Images/Linens/LinB02.jpg';DisplayDesc('" & rs("DescEng") &"');DisplaySKU('" & rs("SKU") &"');DisplayRetail('" & rs("Retail") &"');" & Chr(34) & ">" & Chr(13)

Response.Write "<img src=" & Chr(34) & "/Hart/Merchandise/Images/Linens/LinS02.jpg" & Chr(34) & " border=" & Chr(34) & "1" & Chr(34) & " name=" & Chr(34) & "Linens" & Chr(34) & " width=" & Chr(34) & "100" & Chr(34) & " height=" & Chr(34) & "74" & Chr(34) & "></a><br>" & Chr(13)

Response.Write "<a onMouseover=" & Chr(34) & "Linens.src='/Hart/Merchandise/Images/Linens/LinS03.jpg';MainLinens.src='/Hart/Merchandise/Images/Linens/LinB03.jpg';DisplayDesc('" & rs("DescEng") &"');DisplaySKU('" & rs("SKU") &"');DisplayRetail('" & rs("Retail") &"');" & Chr(34) & ">" & Chr(13)

Response.Write "<img src=" & Chr(34) & "/Hart/Merchandise/Images/Linens/LinS03.jpg" & Chr(34) & " border=" & Chr(34) & "1" & Chr(34) & " name=" & Chr(34) & "Linens" & Chr(34) & " width=" & Chr(34) & "100" & Chr(34) & " height=" & Chr(34) & "74" & Chr(34) & "></a><br>" & Chr(13)

%>


 
Old May 28th, 2008, 10:14 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

The normal way to deal with a recordset is to loop through its rows:
Code:
If NOT(rs.BOF AND rs.EOF)
  Do Until rs.EOF
    'Write out one row of data.
  rs.MoveNext
  Loop
End
Your code seems to rely on the fact that there are five rows. If you must code like this, and it's really horrible, then call rs.MoveNext between each row.

--

Joe (Microsoft MVP - XML)
 
Old May 29th, 2008, 01:26 PM
Friend of Wrox
 
Join Date: Oct 2006
Posts: 112
Thanks: 12
Thanked 0 Times in 0 Posts
Default

your right... i did it with the loop and it worked...
I would like to display only 6 images not the whole database...
Do Until rs.EOF = 6 ???

can you help me how i can put it...

thanking you in advance

 
Old May 30th, 2008, 03:01 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

BOF stands for Beginning of File, EOF for End of File so that won't work.
If you know there will always be at least x images then you can loop using
Code:
For I = 1 to x
' do something
rs.MoveNext
Next
An alternative is just to increment a variable at the end of every loop and see if you've reached x. Otherwise I think you need rs.AbsolutePosition but I haven't use ADO for years and can't remember if that property is always available, it may depend on the cursor type used.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
onmouseover sstuber BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 April 29th, 2008 12:30 PM
<a onMouseover=... question RinoDM HTML Code Clinic 3 March 6th, 2008 01:55 PM
OnMouseOver & OnMouseOut tal Javascript How-To 4 July 19th, 2007 02:29 PM
onmouseover gilgalbiblewheel HTML Code Clinic 4 February 4th, 2005 08:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.