Hi All, this looks like the place to be!
I am fairly new to programming and I have come to a problem that I know someone will have the simplest answer in the world to.
I am building a real estate website in php(ish) and drawing my property data from a Mysql database. On the property viewing page I have set up a repeating table that works fine, it pulls in the pictures fine BUT…
I have the following mouseover script that also works fine if there is only one property but changes only the “CurrentImage” on the last property when it is repeated no mater which thumbnail you cover.
Did I explain that well? No I agree, take a look at the page:
[url]www.test.pinsapoestates.com/props.php
[B]Here is the script:
<script language=”JavaScript”>
var imageArray = Array(
‘<?php echo $row_Recordset1[‘pic1′]; ?>’,'<?php echo $row_Recordset1[‘pic2′]; ?>’,'<?php echo $row_Recordset1[‘pic3′]; ?>’,'<?php echo $row_Recordset1[‘pic4′]; ?>’
);
var imageID = 1;
function SwitchImage(id) {
imageID = id;
DisplayImage();
}
function DisplayImage() {
if(document.images)
document.images[‘currentImage’].src = imageArray[imageID-1];
}
</script>
[B]Here is the framework with the script:
<?php do { ?>
<script language=”JavaScript”>
var imageArray = Array(
‘<?php echo $row_Recordset1[‘pic1′]; ?>’,'<?php echo $row_Recordset1[‘pic2′]; ?>’,'<?php echo $row_Recordset1[‘pic3′]; ?>’,'<?php echo $row_Recordset1[‘pic4′]; ?>’
);
var imageID = 1;
function SwitchImage(id) {
imageID = id;
DisplayImage();
}
function DisplayImage() {
if(document.images)
document.images[‘currentImage’].src = imageArray[imageID-1];
}
</script>
<table width=”92%” height=”409″ border=”0″ cellpadding=”2″ cellspacing=”2″>
<tr>
<td height=”405″ align=”left” valign=”top”> <table width=”510″ height=”406″ border=”0″ align=”left” cellpadding=”2″ cellspacing=”0″>
<tr align=”center” valign=”middle”>
<td colspan=”4″ rowspan=”2″ bordercolor=”#333333″ bgcolor=”#333333″ class=”globalboxfilled”>
<div align=”center”><img src=”<?php echo $row_Recordset1[‘pic1’]; ?>” alt=”Image Viewer” width=”236″ height=”207″ border=”0″ align=”middle” id=”currentImage” title=””><br>
<font color=”#FFFFFF” size=”1″ face=”Verdana”><strong>PASS
OVER SMALL PHOTOS TO ENLARGE</strong></font> </div></td>
<td width=”3″ rowspan=”2″ bgcolor=”#333333″> </td>
<td height=”109″ colspan=”2″ bordercolor=”#333333″ bgcolor=”#333333″ class=”globalboxfilled”><img onMouseOver=”SwitchImage(1);” width=”118″ height=”105″ border=”0″ alt=”Image Viewer” title=”” src=”<?php echo $row_Recordset1[‘pic1’]; ?>” style=”cursor: hand”></td>
<td width=”126″ height=”109″ bordercolor=”#333333″ bgcolor=”#333333″ class=”globalboxfilled”><img onMouseOver=”SwitchImage(2);” width=”118″ height=”105″ border=”0″ alt=”Image Viewer” title=”” src=”<?php echo $row_Recordset1[‘pic2’]; ?>” style=”cursor: hand”></td>
</tr>
<tr align=”left” valign=”top”>
<td height=”109″ colspan=”2″ align=”center” valign=”middle” bordercolor=”#333333″ bgcolor=”#333333″ class=”globalboxfilled”><img onMouseOver=”SwitchImage(3);” width=”118″ height=”105″ border=”0″ alt=”Image Viewer” title=”” src=”<?php echo $row_Recordset1[‘pic3’]; ?>” style=”cursor: hand”></td>
<td height=”109″ align=”center” valign=”middle” bordercolor=”#333333″ bgcolor=”#333333″ class=”globalboxfilled”><img onMouseOver=”SwitchImage(4);” width=”118″ height=”105″ border=”0″ alt=”Image Viewer” title=”” src=”<?php echo $row_Recordset1[‘pic4’]; ?>” style=”cursor: hand”></td>
</tr>
I have tried several ways and put the script in several places with different and sometimes interesting effect! but none of them correct. All other details pulled onto the page are correct.
Any Offers?
Sorry if I have posted incorrectly, I have never needed to ask for help before on a notice board (all self taught you know, and I am an old fella) so please excuse me.
Cheers
Andy