SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2003
    Location
    Charlotte, North Carolina
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamically resizing images

    Hello everyone.

    I have written this function to resize all of the images in my header, but for some reason, my function isn't being called. I'd appreciate some help with debugging:

    ***************************************************

    <HTML>
    <HEAD>
    <TITLE>movement</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

    <SCRIPT LANGUAGE="JavaScript">
    <!--

    function Is() {
    agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer')
    == -1)
    && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 3));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.major == 4) && (this.minor <= 4.03));
    this.ns4 = (this.ns && (this.major == 4));
    this.ns6 = (this.ns && (this.major >= 5));
    this.ie = (agent.indexOf("msie") != -1);
    this.ie3 = (this.ie && (this.major < 4));
    this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0")
    == -1));
    this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0")
    != -1));
    this.ie55 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5")
    != -1));
    this.ie6 = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
    this.aol = (agent.indexOf("aol") != -1);
    this.aol3 = (this.aol && this.ie3);
    this.aol4 = (this.aol && this.ie4);
    this.aol5 = (this.aol && this.ie5);
    }
    var is = new Is();

    function winResize() {
    if(is.ns4 ||is.ns6||is.ie4||is.ie5||is.ie55||is.ie6) {
    history.go(0);
    }
    }
    // -->
    </script>

    </HEAD>
    <BODY onResize="winResize()" BGCOLOR=#284A85 LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>

    <SCRIPT LANGUAGE="JavaScript">
    // JavaScript Document
    function imageResize(image_width, image_height)
    {
    alert("Called");

    var ratio = (image_width / image_height);

    if(is.ns4 || is.ns6)
    {
    available_width = innerWidth;
    available_height = innerHeight;
    }
    else if(is.ie4 || is.ie5 || is.ie55 || is.ie6)
    {
    available_width=document.body.clientWidth;
    available_height=document.body.clientHeight;
    }
    if(is.ie4 || is.ie5 || is.ie55 || is.ie6 || is.ns6 || is.ns4)
    {
    image_width = (available_width * 1.00);
    image_height = (image_width / ratio);
    var image = 'width="' + image_width
    + '" height="' + image_height + '"';

    document.write(image);
    }

    }
    //end JavaScript Document
    </script>
    <!-- ImageReady Slices (movement.psd) -->
    <TABLE WIDTH=1155 BORDER=0 CELLPADDING=0 CELLSPACING=0>
    <TR>
    <TD>
    <IMG SRC="images/indexHeader_01.jpg" javascript:imageResize(180, 55) ALT=""></TD>
    <TD>
    <A HREF="discussion">
    <IMG SRC="images/indexHeader_02.jpg" javascript:imageResize(203, 55) BORDER=0 ALT=""></A></TD>
    <TD>
    <A HREF="articles">
    <IMG SRC="images/indexHeader_03.jpg" javascript:imageResize(130, 55) BORDER=0 ALT=""></A></TD>
    <TD>
    <A HREF="directory">
    <IMG SRC="images/indexHeader_04.jpg" javascript:imageResize(141, 55) BORDER=0 ALT=""></A></TD>
    <TD>
    <A HREF="store">
    <IMG SRC="images/indexHeader_05.jpg" javascript:imageResize(101, 55) BORDER=0 ALT=""></A></TD>
    <TD>
    <A HREF="properties">
    <IMG SRC="images/indexHeader_06.jpg" javascript:imageResize(215, 55) BORDER=0 ALT=""></A></TD>
    <TD>
    <IMG SRC="images/indexHeader_07.jpg" javascript:imageResize(185, 55) ALT=""></TD>
    </TR>
    <TR>
    <TD COLSPAN=7>
    <IMG SRC="images/indexHeader_08.jpg" javascript:imageResize(1155, 174) ALT=""></TD>
    </TR>
    </TABLE>
    <!-- End ImageReady Slices -->
    </BODY>
    </HTML>

    ***************************************************

    Thanks.

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi JMorrow,

    Sorry we let this one slip by. Did you get this working? I can make a few suggestions if you did not.


Bookmarks

Posting Permissions

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