2009-08-15 5 views
0

나는 내 (wordpress) 페이지에서 멋진 탭이있는 상자를 제공하는 몇 가지 코드를 함께 제공합니다. 피드 및 최근 댓글. 며칠 만 지나면 문제가 있음을 알게되었습니다. Firefox는 2 개의 탭 상자를 보여 주며 하나씩 다른 탭을 보여 주며 각 탭은 다른 탭을 보여줍니다. IExplorer는 의도 한대로 단일 기능 탭 상자를 표시합니다.oops - 파이어 폭스의 귀신 탭 박스

어떤 종류의 영혼이 명백한 결함 (?)에 대한 코드를 살펴볼 수 있습니까? - 완성을 위해 PHP에 보관되었지만 피드와 주석이 잘 표시되면 무시할 수 있다고 가정합니다 ... [ 현재 문제 표시 (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> 

답변

0

자바 스크립트 함수 이름은 대소 문자를 구분합니다.

document.getElementById하지 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

최고 팁 gnarf - 많은 감사합니다! –

관련 문제