Forums

ASP

This topic is locked

Database Driven Picture gallery.

Posted 17 Dec 2006 10:42:31
1
has voted
17 Dec 2006 10:42:31 Mike Sal posted:
Hi, I am building a site for a real estate agent. I am working on building the detail page of each home and I am trying to get 10 images + a main image to load in the page.

10 will be thumbnails and 1 will be the main image. When you click the thumbnail it will become the "main" picture.

I have some javascript that allowed me to create this and it works great UNTIL I try to pull the thumbnails into the page from the database.

I have some code from the page that I will post at the end to see if someone can help me figure this out. Thanks in advance. Is there something about pulling data from a database into javacode that I am missing? I got this code from WebThangs.com by the way with a tutorial on how this is supposed to work. I guess the site is going down these days and I cant get help from that site.

THANKS AGAIN

MIKE


<pre id=code><font face=courier size=2 id=code>

&lt;td colspan="5" align="left"&gt;&lt;div align="center" class="darkgrayTextLarge"&gt;&lt;%=(rsdetail.Fields.Item("Address".Value)%&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="5"&gt;&lt;span class="adminTbl"&gt;&lt;img src="&lt;%=(rsdetail.Fields.Item("MainPicture".Value)%&gt;" name="large" width="400" height="301" border="1" align="middle" id="large" /&gt;&lt;/span&gt;&lt;/td&gt; //THIS IMAGE LOADS GREAT AND WORKS FINE//////
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(0)"&gt;&lt;img src= width="75" height="55" name="pimage0" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(1)"&gt;&lt;img src= width="75" height="55" name="pimage1" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(2)"&gt;&lt;img src= width="75" height="55" name="pimage2" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(3)"&gt;&lt;img src= width="75" height="55" name="pimage3" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(4)"&gt;&lt;img src= width="75" height="55" name="pimage4" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(5)"&gt;&lt;img src= width="75" height="55" name="pimage5" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(6)"&gt;&lt;img src= width="75" height="55" name="pimage6" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(7)"&gt;&lt;img src= width="75" height="55" name="pimage7" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(8)"&gt;&lt;img src= width="75" height="55" name="pimage8" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td align="center"&gt;&lt;a href="javascript:image_click(9)"&gt;&lt;img src= width="75" height="55" name="pimage9" border="1"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;table width="400" border="0" align="center" cellpadding="0" cellspacing="0"&gt;
&lt;tr class="cyanTextBold"&gt;
&lt;td&gt;Listing Agent:&lt;br /&gt;
Mike&lt;br /&gt;
&lt;br /&gt;&lt;/td&gt;
&lt;td align="right"&gt;More Photos &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;br /&gt;
Printable Flyer &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;br /&gt;
Virtual Tour &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;br /&gt;
Map Property &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;/td&gt;
&lt;td align="right"&gt;Open House &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;br /&gt;
Request An Appointment &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;br /&gt;
Loan Calculator &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;br /&gt;
Email This Property &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="10"&gt;
&lt;tr&gt;
&lt;td valign="top" class="darkgrayTextLarge"&gt;&lt;%=(rsdetail.Fields.Item("Description".Value)%&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt; &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td align="center" class="cyanTextBold"&gt;&lt;a href="listings1.asp"&gt;Back To Properties&lt;/a&gt; &lt;img src="images/arrow.gif" width="9" height="7" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td colspan="2"&gt;&lt;img src="" alt="The P Dog Team" name="rfbottom" width="700" height="40" id="rfbottom" style="background-color: #000000" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;script language="JavaScript"&gt;
image0 =new Image();
image1 =new Image();
image2 =new Image();
image3 =new Image();
image4 =new Image();
image5 =new Image();
image6 =new Image();
image7 =new Image();
image8 =new Image();
image9 =new Image();


// These 3 lines define the source of the displayed images // HERE IS WHERE THE THUMBNAILS RUN INTO A PROBLEM//
image0.src ="&lt;%=(rsdetail.Fields.Item("MainPicture".Value)%&gt;"
image1.src ="&lt;%=(rsdetail.Fields.Item("Pic1".Value)%&gt;"
image2.src ="&lt;%=(rsdetail.Fields.Item("Pic2".Value)%&gt;"
image3.src ="&lt;%=(rsdetail.Fields.Item("Pic3".Value)%&gt;"
image4.src ="&lt;%=(rsdetail.Fields.Item("Pic4".Value)%&gt;"
image5.src ="&lt;%=(rsdetail.Fields.Item("Pic5".Value)%&gt;"
image6.src ="&lt;%=(rsdetail.Fields.Item("Pic6".Value)%&gt;"
image7.src ="&lt;%=(rsdetail.Fields.Item("Pic7".Value)%&gt;"
image8.src ="&lt;%=(rsdetail.Fields.Item("Pic8".Value)%&gt;"
image9.src ="&lt;%=(rsdetail.Fields.Item("Pic9".Value)%&gt;"

// This defines the source of the preview image
document.images['pimage0'].src=image0.src;
document.images['pimage1'].src=image1.src;
document.images['pimage2'].src=image2.src;
document.images['pimage3'].src=image3.src;
document.images['pimage4'].src=image4.src;
document.images['pimage5'].src=image5.src;
document.images['pimage6'].src=image6.src;
document.images['pimage7'].src=image7.src;
document.images['pimage8'].src=image8.src;
document.images['pimage9'].src=image9.src;

// This defines what to do when an image is clicked on
function image_click(clicks)
{
if(clicks==0){document.images['large'].src=image0.src;}
if(clicks==1){document.images['large'].src=image1.src;}
if(clicks==2){document.images['large'].src=image2.src;}
if(clicks==3){document.images['large'].src=image3.src;}
if(clicks==4){document.images['large'].src=image4.src;}
if(clicks==5){document.images['large'].src=image5.src;}
if(clicks==6){document.images['large'].src=image6.src;}
if(clicks==7){document.images['large'].src=image7.src;}
if(clicks==8){document.images['large'].src=image8.src;}
if(clicks==9){document.images['large'].src=image9.src;}
}
&lt;/script&gt;
&lt;/body&gt;



</font id=code></pre id=code>

Reply to this topic