Jump to content

[SOLVED] Dyamic Table Display for Picture presentation


Grodo

Recommended Posts

Hello Everyone,

 

    At las, another PHP issue (its just like the black plague).  I am trying to practice good web coding technique and stay away from the dread iframes. (Just like the bogey monster under your bed when you were 5, but hidden in cyberspace =/ ) So here is an overview of what i am trying to do.  Values are sent to the Picture Window using a function.  Corresponding values trigger images to show up in the Picture Window dynamically.  When the user clicks on pic3 the value is sent to the Picture window; this displays a larger image of "pic 3" is shown in the Picture Window.  The variable passed corresponds to the images the user clicked on.  For example the user click on pic3 a value of pic3-large.jpg is sent to the getPicture function which displays a larger image in that window.  General layout of the function is written below.  The question that I have is how can I capture the user clicks to send a value to the function getPicture($image)?  My next question is how can I get pic3-large.jpg to show up in the pic3 table, while keeping all other parts static? The table id for the picture viewer is picture_view.  I could use an iframe but I rather do this in PHP.  Since the support for iframes is rather buggy; and really isn’t a cross browser solution.  Here is a picture to better explain what im trying to do and below it is some code.

 

Always Thanks,

Grodo

 

imageview.jpg

 

// Function to receive the string x and display the corresponding image
Function getPicture($image) {
// Echos html code that will set the image
Echo ‘<img src=”somedirecotry/” + $image>’
}


//Html table code for pic3
<table id="Table_01" width="791"  border="0" cellpadding="0" cellspacing="0" bgcolor="#cc9999" style="padding-left: 7;">
  <tr>
  	
      <td colspan="5" id="picture_view">This is the picture viewer!</td>
</tr>
</table>

Link to comment
Share on other sites

Well, the javascript function will be something like:

 

<script type="text/javascript">
function changeimage(image){
document.getElementById('largeimage').src='path/to/images/'+image;
}
</script>

 

It'll then be a case of giving your large image the ID of 'large image', and adding this piece of code into your image tags:

 

onClick="changeimage('imagetoload.jpg')"

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.