Problem with external javascrip file

Discussion in 'JavaScript' started by bluecastle, Apr 3, 2009.

  1. #1
    When the code is in the page, it works well, but when I remove it from it and place it into an external file it still works in IE6 but not in IE7
    my script is very simple, is it something wrong with it?

    link in the head section
    <script type="text/javascript" src="xx.js"></script>

    content of xx.js

    function AlignContentDiv() {
    var nScrWidth = screen.width;
    var nGutterWidth = Math.floor((((nScrWidth-968)/2)*100)/nScrWidth);
    if (nGutterWidth>3) {
    nGutterWidth -=1;
    }
    elem = document.getElementById("gutterdiv");
    elem.style.width = nGutterWidth+"%";
    }

    function reloadPage() {
    window.location.reload();
    }
     
    bluecastle, Apr 3, 2009 IP
  2. GreatMetro

    GreatMetro Peon

    Messages:
    117
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Do you have a link for me to test?
     
    GreatMetro, Apr 3, 2009 IP
  3. bluecastle

    bluecastle Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I just put everything together again and it worked! I couldn't identify the error though
     
    bluecastle, Apr 6, 2009 IP