Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 28th, 2008, 09:48 AM
Friend of Wrox
Points: 550, Level: 8
Points: 550, Level: 8 Points: 550, Level: 8 Points: 550, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , , .
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)

%>


Reply With Quote
  #2 (permalink)  
Old May 28th, 2008, 10:14 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
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)
Reply With Quote
  #3 (permalink)  
Old May 29th, 2008, 01:26 PM
Friend of Wrox
Points: 550, Level: 8
Points: 550, Level: 8 Points: 550, Level: 8 Points: 550, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , , .
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

Reply With Quote
  #4 (permalink)  
Old May 30th, 2008, 03:01 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:22 PM.


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