www.webdeveloper.com
Results 1 to 3 of 3

Thread: displaying images in new frames

  1. #1
    Join Date
    Mar 2006
    Location
    Portchester UK
    Posts
    21

    Question displaying images in new frames

    I have written a code to enlarge an image from a thumbnail. What I am trying to do is have a series of thumbnails in one frame and enlarge the image in another frame so that the enlarged image is always in a constant position.
    this is the code:
    Code:
    <style>
    }
    .thumbNormal {
    border:1px solid #000000;
    }
    .thumbSelected {
    border:1px solid #ff0000;
    }
    </style>
    <!--
    var lastID = 0;
    function SelectImg(id) {
    if (lastID > 0) {
    document.getElementById(lastID).className = "thumbNormal";
    }
    document.getElementById(id).className = "thumbSelected";
    document.getElementById(0).src = document.getElementById(id).src;
    lastID = id;
    }
    function LoadTrigger() {
    SelectImg(1);
    }
    window.onload = LoadTrigger;
    //-->
    Then I display the thumbnails:
    Code:
    <table  border="0" cellspacing="8" cellpadding="4" >
    
    			
    			<tr>
    				<td><img id=1 class="thumbNormal" SRC="dogs/1.gif" WIDTH=80 HEIGHT=60 ALT="Click to Enlarge" onclick="SelectImg(1)"></td>
    				<td><img id=2 class="thumbNormal" SRC="dogs/2.gif" WIDTH=80 HEIGHT=60 ALT="Click to Enlarge" onclick="SelectImg(2)"></td>
    			</tr>
    						
    		</table>
    Then display the enlarged image:
    Code:
    <table border="0" cellspacing="8" cellpadding="8">
    			<tr>
    			<td>			
    			<img id=0 src="" GALLERYIMG="no">
    			</td>
    			</tr>
    		</table>
    What I want to do is the last part in a separate frame, but I dont know how to identify the image so that it is recognised in that frame. There can be up to 60 thumbnails to display.
    Can anybody help?
    Last edited by Nobby; 01-05-2007 at 11:49 AM.

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    Keep in mind that a frame is a separate window with its own document. Usually a frame will have a top window (the real physical browser instance) and a number of siblings. When you reference things from the top window (the frameset page), the access can be done by the name of the window (e.g.: framename.document.getElementById(...)). When you reference things from a sibling, you can envoke the heirarchy from the top (e.g.: window.top.framename.document.getElementById(...)).

  3. #3
    Join Date
    Jul 2006
    Posts
    146

    Maybe you can send the image name in by the url and then get from ther

    especially if you used a naming convention like img1, img2, etc.

    Send the total amount of images to look for in the URL, imgCount=55;

    Then, loop through from 0 to imgCount, and see if that variable is set.

    If it is set you have captured a request for it..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles