WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Javascript messing up theme (5 posts)

  1. tomhanna
    Member
    Posted 8 years ago #

    I have a Javascript that is messing up a theme, causing 50 some validation errors and making the posts column slide down the page in Internet Explorer. I tried the external javascript thing and I must not be doing it right because I can't get it to run at all that way.

    I'm using the 4-column Identification Bands theme. This is the site:
    http://election2008.tom-hanna.org

    I put the Javascript in this file:
    http://election2008.tom-hanna.org/setcountdown.js

    In addition to the stuff inside the scripts tag, the script uses this code:
    <ilayer id="countdownnsmain" width=&{countdownwidth}; height=&{countdownheight}; bgColor=&{countdownbgcolor}; visibility=hide><layer id="countdownnssub" width=&{countdownwidth}; height=&{countdownheight}; left=0 top=0></layer></ilayer>

    which I have tried including in the external Javascript file and also tried just adding it to the template file. I read Lorelle's excellent post on the subject of external javascripts at her blog and several other resources and either I'm not doing it right or there's something interfering. Is there any other solution?

    I've tried putting this in every template file except the footer and I still get the issue, even if I put it after the post content. It won't do much for me in the footer.

    Nothing urgent here, but any help would be appreciated.

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    If you are including external js, remove all the stuff at the top such as comments and what the file is. Your should have as the first line:

    function setcountdown(theyear,themonth,theday){

    Nothing above that. See what that does ?

    I can't see how you are including. I do it this way:
    <script type="text/javascript" src="http://www.tamba2.org.uk/T2/files/ntitles.js"></script>

  3. tomhanna
    Member
    Posted 8 years ago #

    Thanks. That got the Javascript working without validation errors, but the Internet Explorer problem with the post content sliding down the page is still happening.

    I'm enclosing the script in it's own <div> and this is all I put in the stylesheet for it:

    .countdown {
    text-align: left;
    font-size: 40%;
    }

    I'm digging through all the posts for similar issues looking for anything relevant.

  4. tomhanna
    Member
    Posted 8 years ago #

    Sorry to bump, but I set the content width to auto and that fixed it in Internet Explorer, but now the content appears at the bottom of the page in Firefox.

  5. tomhanna
    Member
    Posted 8 years ago #

    Problem solved! I found this page on "Hack-free CSS for IE"

    http://virtuelvis.com/archives/2004/02/css-ie-only

    Thanks for the help with the javascript, podz.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.