www.webdeveloper.com
Results 1 to 3 of 3

Thread: Another Problem with Simple Javascript

  1. #1
    Join Date
    Jun 2008
    Posts
    21

    Another Problem with Simple Javascript

    I am writing code that can sort posts on a blog site. If the page isn't being sorted by a label a link to the label is provided. If the page is being sorted by a label the label is listed in bold with no link. I am using the following javascript to do this:
    Code:
    if (window.location.href == 'http://flashcreations-faq.blogspot.com/search/label/Windows Vista') {
    document.getElementById('sort1a').style.display = 'none';
    document.getElementById('sort1b').style.display = 'block';
    }
    
    if (window.location.href == 'http://flashcreations-faq.blogspot.com/search/label/Windows XP') {
    document.getElementById('sort2a').style.display = 'none';
    document.getElementById('sort2b').style.display = 'block';
    }
    
    if (window.location.href == 'http://flashcreations-faq.blogspot.com/search/label/both_OS') {
    document.getElementById('sort3a').style.display = 'none';
    document.getElementById('sort3b').style.display = 'block'
    }
    With the following HTML:
    Code:
    <ul><li id="sort1a"><a href="http://flashcreations-faq.blogspot.com/search/label/Windows Vista">Windows Vista (2)</a></li>
      <li id="sort1b" style="display:none"><strong>Windows Vista (2)</strong></li>
      <li id="sort2a"><a href="http://flashcreations-faq.blogspot.com/search/label/Windows XP">Windows XP (0)</a></li>
      <li id="sort2b" style="display:none"><strong>Windows XP (0)</strong></li>
      <li id="sort3a"><a href="http://flashcreations-faq.blogspot.com/search/label/both_OS">Both (9)</a></li>
      <li id="sort3b" style="display:none"><strong>Both (9)</strong></li></ul>
    To achieve this. You can see a live example of this on my blog: http://flashcreations-faq.blogspot.com/

    The problem is only the Both label will bold when sorting by it. The other two stay the same. Please Help Me!!!
    Thank You So Much!!!!
    webcoder13

  2. #2
    Join Date
    Jun 2008
    Posts
    21
    Please Help Me!!!!!!! Thanks!

  3. #3
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,773

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