SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast johanna0507's Avatar
    Join Date
    Nov 2006
    Location
    London, England
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    3 Col layout script problem

    Hi!
    I have a Wordpress blog athttp://www.vikingprincess.net"

    In the Head tag in Header.php, I put a javascript that
    makes all three columns in my theme equal height.

    The script was recommended at Sitepoint and used to work fine on all pages.
    http://www.sitepoint.com/newsletter/...d=3&issue=70#7

    Suddenly for no reason that I can spot, the javascript only gets executed when the root page is loaded. The root page is at http://www.vikingprincess.net. You know that the javascript was loaded if a little messagebox pops up! Also, obviously it was loaded if the columns are equal height.

    However if I load any other page on the site, the javascript does not get called in header.php, and the column height is not adjusted. See <a www.vikingprincess.net/29/site-design-feedback-needed"

    I don't know much about how javascript works, so I don't know how to troubleshoot this!

    Please help if you can!
    C.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It seems like it's looking for x.js in the wrong folder...on the first page you explicitly point to
    http://www.vikingprincess.net/wp-con...ugendstil/x.js

    but on other pages you just point to
    x.js

    That's likely why it's not working.

  3. #3
    SitePoint Enthusiast johanna0507's Avatar
    Join Date
    Nov 2006
    Location
    London, England
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, thanks for responding. Actually, I only temporarily tried using the full path. For some reason that didn't work at all. When I move it back to just "x.js" the behaviour is back to what I described above..

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well on this page:
    http://www.vikingprincess.net/29/sit...eedback-needed

    I'm getting an error "Object Required" on line 49 which is:
    xAddEventListener(window, "resize", adjustLayout, false);

    I'd suggest creating a "scripts" folder in the root of the site where you store all your js files, and then reference it like:
    <script src="/scripts/x.js" type="text/javascript"></script>

  5. #5
    SitePoint Enthusiast johanna0507's Avatar
    Join Date
    Nov 2006
    Location
    London, England
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi!
    Thanks! I'll definitely add the folder you mention.
    How were you able to verify the JS?
    I only verified the HTML, PHP and CSS which was ok.
    I didn't know how to check the JS!

    I use Dreamweaver.
    Sounds like this something to follow up on. I just have to work out what I need to do!

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just use internet explorer 6 with all js error messages turned on, every time it hits an error I get a popup window thingy.

    ps the Firefox Error Console is (lots) better than the IE error system. If you use Firefox check it out (under Tools)

  7. #7
    SitePoint Enthusiast johanna0507's Avatar
    Join Date
    Nov 2006
    Location
    London, England
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the solution was to put

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

    instead of

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

    Still no idea why the absolute path didn't work..

  8. #8
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    absolute path
    You changed it to use the absolute path! Before it was the relative path.

  9. #9
    SitePoint Enthusiast johanna0507's Avatar
    Join Date
    Nov 2006
    Location
    London, England
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the tips Jim! Yes, of course I use FF! Can't stand IE...
    I haven't quite worked out how to use the developers tools such as Error Console.

    I didn't see your two last posts until now...

    Hmm, don't get that bit about absolute path. I could have sworn absolute path was the full path that could be used over the internet.. I'll have to look it up!

    Thanks for helping!

  10. #10
    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)
    Jim is always right-on

    For reference, here's a follow-up to that article.


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
  •