javascript gets in the way of validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saputello
    New Member
    • Apr 2008
    • 9

    javascript gets in the way of validation

    hello

    every page of my site is compliant with strict xhtml standards but for the javascript i use for my footer. when i remove the javascript from the page and link it to a .js document containing the necessary code, no content shows up in IE and firefox. what gives? i have some more javascript linked to a separate file which works fine!

    here's the url: http://nostramerica.com/northBeach.html

    And here's what i've done to include the javascript file:
    [html]
    <link href="nostrAmer ica.css" rel="stylesheet " type="text/css" />

    <script type="text/javascript" src="drop_down. js" />


    <script type="text/javascript" src="footer.js" />






    </head>
    <body>

    and here's a page with the javascript included:

    <link href="nostrAmer ica.css" rel="stylesheet " type="text/css" />

    <script type="text/javascript" src="drop_down. js"></script>


    <script type="text/javascript">

    function getWindowHeight () {
    var windowHeight = 0;
    if (typeof(window. innerHeight) == 'number') {
    windowHeight = window.innerHei ght;
    }
    else {
    if (document.docum entElement && document.docume ntElement.clien tHeight) {
    windowHeight = document.docume ntElement.clien tHeight;
    }
    else {
    if (document.body && document.body.c lientHeight) {
    windowHeight = document.body.c lientHeight;
    }
    }
    }
    return windowHeight;
    }
    function setFooter() {
    if (document.getEl ementById) {
    var windowHeight = getWindowHeight ();
    if (windowHeight > 0) {
    var contentHeight = document.getEle mentById('conta iner').offsetHe ight;
    var footerElement = document.getEle mentById('foote r');
    var footerHeight = footerElement.o ffsetHeight;
    if (windowHeight - (contentHeight + footerHeight) >= 0) {
    footerElement.s tyle.position = 'relative';
    footerElement.s tyle.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
    }
    else {
    footerElement.s tyle.position = 'static';
    }
    }
    }
    }
    window.onload = function() {
    setFooter();
    }
    window.onresize = function() {
    setFooter();
    }

    </script>


    </head>
    <body>

    [/html]
    thanks for your time!
    Last edited by drhowarddrfine; Apr 13 '08, 10:03 AM. Reason: Please use code tags.
  • AutumnsDecay
    New Member
    • Mar 2008
    • 170

    #2
    I don't even see where your mark-up calls the footer.js file. I see where it sets the footer() action, but no where in that code is the function called. Not that I can see, anyhow.

    What you could try is including the file where you want it.

    Such as:

    Code:
    <?php include ('footer.js'); ?>
    Also, if you're trying to get people to enroll to that, you might want to omit the 'and strip clubs' part of your content.

    Haha.

    If your target audience is 20 year olds, great. But if not, I'd consider it. :)
    Last edited by AutumnsDecay; Apr 13 '08, 01:31 PM. Reason: Little note.

    Comment

    Working...