
September 15th, 2005, 04:06 AM
|
|
|
|
Join Date: Apr 2007
Posts: 8
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Help for JavaScript with PHP
I have some PHP code that retrieves text information and image information from a database including 3 thumbnails and a larger image. The
JavaScript usually works for me and triggers an image change when you click one of the thumbnails. It works fine on this site:
www.ercrosscountry.com/east-jordan.php , but I am having problems with the code when i am trying to use it with this database version below. I
have tried numerous ways to get this to work, but I cannot figure it out....please help.
php Code:
Original
- php Code |
|
|
|
<script type="text/javascript" language="JavaScript">//Java to reveal the larger image on click function changeImage(filename, description, size) { document.mainimage.src = filename; document.all("description").innerText = description; document.all("size").innerText = size; } </script> </head> <!--------------more page code here--------------------------//--> <table width="100%" border="0" cellspacing="2" cellpadding="2"> <?php do { ?> <tr valign="top"> <td width= "51%"><h1> <?php echo ucfirst($row_Project_list['project']); ?></h1> <p><?php echo $row_Project_list['description']; ?></p> <p> </p></td> <td width="49%"><p><img src="<?php echo $imagelarge.$row_Project_list['image1'];?>" alt="Elmer's Projects" name="mainimage" width="340" height="240" style="background-color: #CCCCCC"></p> <?php { '<a href="javascript:changeImage(''.$imagelarge.$row_Project _list['image1'].'')"><img src="'. $imagethumb.$row_Project_list['image1'].'" alt="" width="109" class="image-one2" style="background-color: #0099FF"></a>'; '<a href="javascript:changeImage(''.$imagelarge.$row_Project _list['image2'].'')"><img src="'. $imagethumb.$row_Project_list['image2'].'" alt="" width="109" class="image-one2" style="background-color: #0099FF"></a>'; '<a href="javascript:changeImage(''.$imagelarge.$row_Project _list['image3'].'')"><img src="'. $imagethumb.$row_Project_list['image3'].'" alt="" width="109" class="image-one2" style="background-color: #0099FF"></a>'; } ?> <p></p></td> </tr> </table> <?php ?>
|