www.webdeveloper.com
Results 1 to 3 of 3

Thread: Javascript in Blogspot with Firefox?

  1. #1
    Join Date
    Jul 2005
    Location
    Michigan
    Posts
    43

    Javascript in Blogspot with Firefox?

    I wonder if someone would be able to tell me what's wrong with the following script. I do all my (infrequent) Javascripting on a corporate intranet where all the users are on Internet Explorer, so I've never had to contend with cross-browser coding issues. But this is something I'm trying to make work on a friend's Blogspot blog.

    If you embed the code in a plain HTML page, the script works fine in both IE and Firefox. But if you try to use the script in a Blogspot blog, it does not work in Firefox. (It still works in IE, however.)

    What needs to be changed to make it work in Firefox?

    Here's the code:

    Code:
    <p>Your first paragraph goes here.</p>
    <p id="more"><a onclick="less.style.display='inline'; more.style.display='none'; fullpost.style.display='inline';return false" href="javascript://">More...</a></p>
    <span id="fullpost" style="display: none;"><p>The rest of your post goes here.</p>
    <p id="less" style="margin-top: 18px; width: 100%;"><a onclick="fullpost.style.display='none'; less.style.display='none'; more.style.display='inline';return false" href="javascript://">Collapse Post</a></p></span>
    And here's a link to the blog where you can see it works in IE7, but not FF: http://althousewatch.blogspot.com/

    I greatly appreciate the assistance!

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    document.getElementById('less').style.display='inline'


    and please show the more div first, and hide it later using javascript, for those of us that don't want to have javascript enabled to read something that should be in plain text anyway.

  3. #3
    Join Date
    Jul 2005
    Location
    Michigan
    Posts
    43
    Scragar,
    Thank you very much for the help!

    Also: Excellent suggestion to show the full post by default and hide later with Javascript. I never would have thought of that, but you're right, it's much friendlier behavior.

    Cheers and regards.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles