Results 1 to 7 of 7

Thread: Opening a Picture in Iframe

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Location
    israel
    Posts
    81

    Opening a Picture in Iframe

    Hey!!!
    I M Trying to open a picture in an Iframe but the problem is that if the picture is bigger then the Iframe i get Scroll bars.

    i wnat to be able to send the picture to the Iframe and not getting scroll bars meaning : i want to tell the Iframe to make the pictures smaller as the size of the Iframe.

    what should i do ?

    10x

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    mae the picture holder like this:
    <img id="myimg" width="50" height="500" alt="my image" />

    Then when you edit it's src attribute it'll still stay the same width andheight.
    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Registered User
    Join Date
    Jul 2001
    Location
    israel
    Posts
    81
    This is the code :
    <a href=HodHasharon_Big_1.jpg border=0 target="BigPic" width=30 height=30>
    <img src=HodHasharon_Big_1.jpg height=100 width=120></Img></a>

    my Iframe Name is BigPic and then when i click the picture It opens in the frame.

    and i want the frame to be able to open the picture smaller then it realy is and not adding scroll bars to it self.

    10X

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    ok. firstly that code is wrong. </img> doesn't exist... among other mistakes.

    You'l have to use JavaScript for this. here's some untested code.
    Iframe code (iframe.html):
    Code:
    <html>
    <img id="myimg" width="50" height="500" alt="my image" />
    </html>
    the main page:
    Code:
    <html>
    <script type="text/javascript">
    function doIt(img) {
    document.getElementById('myIfr').myimg.src=img
    }
    </script>
    <iframe src="iframe.html" id="myIfr"></iframe>
    <button onClick="doIt('me.jpg')"><img src="me.jpg" /></button>
    </html>
    As I said, that's untested. I've never been good at that part of the DOM, so I won't be suprised if it doesn't work. I very rarely use iframes or even frames myself. If the entire purpose of this iframe is to hold these images, then just use an image holder, not an iframe.
    Have I helped you? Please Rate my posts.

  5. #5
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by Acidic
    ok. firstly that code is wrong. </img> doesn't exist... among other mistakes.

    You'l have to use JavaScript for this. here's some untested code.
    Iframe code (iframe.html):
    Code:
    <html>
    <img id="myimg" width="50" height="500" alt="my image" />
    </html>
    the main page:
    Code:
    <html>
    <script type="text/javascript">
    function doIt(img) {
    document.getElementById('myIfr').myimg.src=img
    }
    </script>
    <iframe src="iframe.html" id="myIfr"></iframe>
    <button onClick="doIt('me.jpg')"><img src="me.jpg" /></button>
    </html>
    As I said, that's untested. I've never been good at that part of the DOM, so I won't be suprised if it doesn't work. I very rarely use iframes or even frames myself. If the entire purpose of this iframe is to hold these images, then just use an image holder, not an iframe.
    You're using the XHTML 'close all tags' thing - don't confuse him more than neccessary
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    VbNeo: Xhtml once will replace html, so why not learn it now? It's not that hard at all.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  7. #7
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    Originally posted by Jop
    VbNeo: Xhtml once will replace html, so why not learn it now? It's not that hard at all.
    You should, however, have made him aware of that - since changes would be he would make a non valid hybrid between HTML 4.01 and XHTML utilizing what you gave him.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

Posting Permissions

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



Click Here to Expand Forum to Full Width