Solved

How can I change an image in another frame

Posted on 2008-10-29
10
261 Views
Last Modified: 2012-05-05
I am trying to build a web page so that soldiers going overseas can upload pictures and let the folks back home see them and copy them so mom and kids can still see dad.

I have 3 frames: PicturePage.html; ShowPictures.html and BottomBanner.html.

PicturePage.html will have at least 30 pictures for the parents to look at.  When they click on a picture here, I want an enlarged picture to display in ShowPicture.html. Now they can right click and download/save the picture.

BottomBanner is just for instructions
0
Comment
Question by:juricta
  • 5
  • 4
10 Comments
 
LVL 18

Expert Comment

by:Pawel Witkowski
ID: 22839444
If all .html files are from one server this is trival. Just read for example this topic:

http://bytes.com/forum/thread147921.html


If you .html files are on other server ...Thats a security server policies and you have to figure out something :)
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22848705
<a href="bigimage.jpg" target="pictureFrame"><img src="smallImage.jpg" border="0"></a>

No script needed
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22848725
The example given by wilq is not very compatible.

Here is a better version (assuming all pages are from the same server)


I am assuming
 
<frame name="showpicture" src="showpicture.html">
 
and in showpicture.html:
 
<img src="blank.gif" NAME="bigImage"> - it is important not to have height and width here unless all images have the same format
 
picturepage.html:
<a href="bigimage.jpg" target="showpicture" 
onClick="top.showpicture.document.bigImage.src=this.href;
return false"><img src="smallimage.jpg" border="0"></a>
 
the return false is also imperative and if javascript is not available, the frame will have the big image loaded anyway

Open in new window

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:juricta
ID: 22848748
mplungian,

What page does this code go on?  I would like to test it.  I tried the solution from wilg32 and it did not work at this time.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22848814
the code goes on each of the small images

So assuming you have

<frameset ...>
<frame name="showpicture" src="showpicture.html">
and in showpicture where you want the big picture to appear you have

<img src="blank.gif" NAME="bigImage">

where blank.gif is a placeholder image

the picturepage.html will need to have

<a href="submarine_picture_big_format.jpg" target="showpicture" 
onClick="top.showpicture.document.bigImage.src=this.href;
return false"><img src="submarine_picture_thumbnail.jpg" border="0"></a>
 
<a href="me_and_my_gun_big_format.jpg" target="showpicture" 
onClick="top.showpicture.document.bigImage.src=this.href;
return false"><img src="me_and_my_gun_thumbnail.jpg" border="0"></a>
 
so the image urls change but the rest stays the same
 
If you still do not get it to work, please attach the frameset code and the showpicture.html and an example of picturepage.html

Open in new window

0
 

Author Comment

by:juricta
ID: 22848938
I now get that the "page cannot be displayed".  aNY HELP?  Here is my code:

Frameset.html
     <frameset cols="145,*">
     <frame src="picturepage.htm" name="menu">
      <frameset rows="*,80">
     <frame name="showpicture" src="showpicture.htm">
     <frame src="BottomBanner.html" name="bottom">
      </frameset>
     </frameset>

picturepage.htm
     <a href="bigimage.jpg" target="showpicture"
     onClick="top.showpicture.document.bigImage.src=this.href; return false"><img        
     Src="images/Airborne.jpg" width="678" height="472" alt="" border="0"></a>

showpicture.htm
     <img src="blank.gif" NAME="bigImage">

0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 22849350

That has nothing to do with the script.

that has to do with a missing page in your folder.

Also I meant


picturepage.htm

     <a href="images/Airborne.jpg" target="showpicture"
     onClick="top.showpicture.document.bigImage.src=this.href; return false"><img        
     Src="images/Airborne_thumbnail.jpg"
width="60" height="40" alt="" border="0"></a>

There is no room in the left page to show the full size image

0
 

Author Comment

by:juricta
ID: 22857184
mplungian,

I made the corrections you showed above.  When I click on the image in the left frame (picturepage.htm) the picture does not display in the right frame (showpicture.htm)  If I RIGHT CLICK on the imag holder in the right frame and choose properties, it DOES say that the picture name is the SAME as the one I CLICKED on in the right frame.  Any ideas?  I am using EVRSOFT as my web page builder
0
 

Author Closing Comment

by:juricta
ID: 31511255
Thanks for your help.  I did not ask this originally but...how would this be done if the images were in a sub directory (called "images"  to the one holding the htm files?

Excellent help
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22857811
The code does the following:

<a    <<< A hyperlink 
 
href="images/Airborne.jpg" <<<  Make the link point to a big image in the images subdir under where the html file is
 
target="showpicture" <<<< if the user does not have javascript turned on, load the big image into the frame
 
onClick="top.showpicture.document.bigImage.src=this.href; <<<< Take the image mentioned in the href and replace an image named bigImage in the html page living in the frame called showpicture
 
return false" <<<< Do NOT follow the link - the javascript did the action here
 
><img        
    Src="images/Airborne_thumbnail.jpg" <<< inside the link put a THUMBNAIL of the image we had
width="60" height="40" alt="" border="0"></a>

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding Row and Cell on a table 14 25
VBScript on Html 15 48
Reactjs with .NET 3 37
maven not picking latest jar instead picking old jar from .m2 12 22
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question