Results 1 to 2 of 2

Thread: Need help with javascript

  1. #1
    Join Date
    Apr 2006
    Posts
    6

    Need help with javascript

    Hi all,

    I`m using the following piece of javascript which I`m using as an image viewer. It works for what I need, however the images I need to use are a little wider than my fixed width design. Using the resize in the img tags obviously works but then the image gets distorted.

    I was wondering if or how I could encorporate an iframe into the script? This way I can keep the images at full size without worrying about distortion. failing that, any other suggestions? Many Thanks.

    Code:
    <script>
    function changeImage(filename)
    {
       document.mainimage.src = filename;
    }
     </script>
    Code:
    A href="javascript:changeImage('http://apollo.lsc.vsc.edu/data/web/models/ecmwf/slpprecip/24.gif')">24</A>
    A href="javascript:changeImage('http://apollo.lsc.vsc.edu/data/web/models/ecmwf/slpprecip/48.gif')">48</A>
    <A href="javascript:changeImage('http://apollo.lsc.vsc.edu/data/web/models/ecmwf/slpprecip/72.gif')">72</A>
    Code:
    <img name="mainimage" src="http://apollo.lsc.vsc.edu/data/web/models/ecmwf/slpprecip/24.gif" style="border:1px solid 
    #e2e2e2" width="780" height="580">

  2. #2
    Join Date
    Jun 2004
    Posts
    173
    I'm not sure I understand, but if you are trying to constrain the display to a certain size while avoiding distortion, why not place the image in a div of the desired size with overflow:hidden (or overflow:auto if you want scroll bars to appear with oversize content)?

Similar Threads

  1. Problem with javascript Slideshow and transparent PNG files
    By moez in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 20 Jan 2006, 02:56 PM
  2. element specific javascript
    By gumbo in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 04 Dec 2005, 06:25 PM
  3. element specific javascript
    By gumbo in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 04 Dec 2005, 06:23 PM

Posting Permissions

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