Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 334535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:03:47+00:00 2026-05-12T10:03:47+00:00

I was happy to cobble some code together that gives me a nice looking

  • 0

I was happy to cobble some code together that gives me a nice looking tabbed-box on my (wordpress) page – 2 tabs; a feed and recent comments. Only after a few days have I noticed a problem: Firefox shows 2 tab boxes, one below the other, each showing the other tab. IExplorer displays a single functional tab-box as intended.

Could some kind soul take a look at the code for an obvious glitch(?) – I kept in the php for completeness, but as the feeds and comments display fine, I assume that can be ignored…
[Currently showing the issue (with Firefox) here]

<script>
  function diarytabs(newtab,oldtab) {
    if (document.getelementbyid)
    {
      document.getelementbyid(newtab).style.display = "inline";
      document.getelementbyid(oldtab).style.display = "none";
      return false;
    }
    else if (document.all)
    {
      document.all[oldtab].style.display = "none";
      document.all[newtab].style.display = "inline";
      return false;
    }
    else 
    {
      return true;
    }
  }
</script>

<div class="diary-tab" id="diary1">
  <ul class="tabs">
    <li class="each-tab" id="diary11">New Comments 
    <li id="diary12"><a onclick="return diarytabs('diary2','diary1')" href="#">Decanter News</a> 
  </ul>
  <?php 
  $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID,  comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 6");
  $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
  if ( $comments || $numcomments ) :?>
    <ul class="tab-list">
    <?php 
    if ( $comments ) {
      foreach ($comments as $comment) {
      echo '<li>' . sprintf(__('%2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
      edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 
      echo '</li>';
      }
    }
    ?>
    </ul>
  <?php endif; ?>

  &nbsp;&nbsp;
  <?php if ( $numcomments ) : ?>
    <strong><?php echo sprintf(__('Comments in moderation (%s)'), number_format($numcomments) ); ?> &raquo;</strong>
  <?php endif; ?>
</div>
<div class="diary-tab" id="diary2">
  <ul class="tabs">
    <li id="diary21"><a onclick="return diarytabs('diary1','diary2')" href="#">New Comments</a></li>
    <li class="each-tab" id="diary22">Decanter News
  </ul>
  <?php
    require_once (ABSPATH . WPINC . '/rss-functions.php');
    // here's where to insert the feed address
    $rss = @fetch_rss('http://www.decanter.com/feeds/rss/news.xml');
    if ( isset($rss->items) && 0 != count($rss->items) ) {
  ?>
    <ul class="tab-list">
      <?php
      // here's (6) where to set the number of headlines
      $rss->items = array_slice($rss->items, 0, 6);
      foreach ($rss->items as $item ) {
      ?>
        <li>
        <a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a>
        </li>
      <?php } ?>
    </ul>
  <?php } ?>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:03:47+00:00Added an answer on May 12, 2026 at 10:03 am

    Javascript function names are case sensitive.

    document.getElementById not document.getelementbyid

    alert(typeof document.getelementbyid); // undefined
    alert(typeof document.getElementById); // function
    
    // you want to use this:
        if (document.getElementById)
        {
          document.getElementById(newtab).style.display = "inline";
          document.getElementById(oldtab).style.display = "none";
          return false;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am quite happy to code out tables by hand when making a database
I'm very happy of Netbeans 6.5 diff tool, I have to ask some questions
Happy Monday o/ I'm looking to do the following within a stored proc select
Happy Friday SO! I'm building a multi-WinForm application and am having some troubles. I
Happy Friday All, I have an ASP.net 2.0 website that I'm updating to .Net
Happy New Year Everyone! I have this existing php code I did when I
Happy New Year. I have a bunch of SOAP Web Services. They all have
I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets
Say a client is happy with the work you've done creating a script to
I'm a happy user of DevExpress components, though currently I'm still on a linux

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.