SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can CSS Fix this JavaScript Function?

    If you visit http://paleozoo.geoworld.org/time/cenozoic/ and scroll to the bottom of the page, you'll see the footer floating high above the bottom of the page. It rests on the bottom only if...

    1) You click on "Related Links," opening that JavaScript function.
    2) There's little or no text inside "Related Links."
    3) I remove the article from the page.

    In other words, the text inside the JavaScript function is initially invisible to the visitor, but it appears to push against the bottom of the page.

    I'm not sure if this can be fixed with JavaScript or CSS, but I thought I'd try here first. Do you know of any cure?

    Thanks.

  2. #2
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If it helps, you have a couple of errors :
    Error: missing ) after argument list
    Source File: http://paleozoo.geoworld.org/time/cenozoic/#Links2
    Line: 32, Column: 84
    Source Code:
    document.getElementById(Level.id+i).style.display=(document.getElementById(Lev el.id+i).style.display=='none')?'block':'none';
    (I think this is because the word 'level' has been broken up).

    Error: document.getElementById(rest_of_articles[i]) has no properties
    Source File: http://paleozoo.geoworld.org/a1/js/swapclass2.js
    Line: 16
    What you have there is similar to what I have on my own site, but I don't have the same problem... (sorry). Your script is very complicated and to be honest, I don't really understand it.

    I hope this helps a little (though I imagine it won't).

  3. #3
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BonRouge
    If it helps, you have a couple of errors :
    (I think this is because the word 'level' has been broken up).



    What you have there is similar to what I have on my own site, but I don't have the same problem... (sorry). Your script is very complicated and to be honest, I don't really understand it.

    I hope this helps a little (though I imagine it won't).
    Good catch. I tracked that script down and fixed it. You're right - it didn't fix the problem. But it probably fixed some other problem I wasn't even aware of.

    Thanks.

  4. #4
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BonRouge
    What you have there is similar to what I have on my own site, but I don't have the same problem... (sorry). Your script is very complicated and to be honest, I don't really understand it.

    I hope this helps a little (though I imagine it won't).
    Actually, if your script is simpler, would you mind sharing it?

  5. #5
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem...
    This is the script :
    Code:
    function tcform(div) 
    {
    obj=document.getElementById(div);
    obj.style.display=!(obj.style.display=="block")? "block" : "none";  
    document.location.href="#end";
    }
    (I put an anchor (#end) at the bottom of the page because without it, the form I'm showing appeared, but you had to scroll down to see it).

    Here's the relevant html :
    HTML Code:
    <div id="comonpag">
    <span><a onclick="tcform('commentform')">Comment on this page</a></span>
    </div> 
    <form id="commentform" action="submitted.php" method="post">
    ---form stuff here---
    <a name="end"><input id="send" type="submit" value="Submit" /></a> 
    </form>
    The form is set to 'display:none' in the css - I imagine yours is the same. There are accessibility issues here, but I can live with it. Your page is the same. Without javascript, no-one will see those links (as I'm sure you know).

    I'm no javascript expert (or any other kind of expert for that matter) so I want to use things that I understand. This script here is reeallly simple, so I like it.

  6. #6
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BonRouge
    Without javascript, no-one will see those links (as I'm sure you know).
    I don't understand. I designed my script so that the div with the links freezes open if JavaScript is disabled.

    I'll check out your script. Thanks.

  7. #7
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by geosite
    I don't understand. I designed my script so that the div with the links freezes open if JavaScript is disabled.
    Ah! My apologies... You're right.

  8. #8
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Small update :

    I've just updated my files so that my form will do the same thing - stay open if there's no javascript.

    I have another function which is basically the same as that one there, but without the 'location' part. I'm using this to hide the form on load. I changed the css to 'display:block'.

    (In case you're interested).


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
  •