Results 1 to 8 of 8

Thread: Drop list show/hide not working in IE?

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default Drop list show/hide not working in IE?

    Okay, I will be the first to admit I don't know much about JS. But I have a fairly nice "FAQs" page on my site written in JS.

    The effect is you go to the page and there is a drop down list of 14 or so "questions" from which you can select. You choose a question and the "answer" magically appears below the drop down box in it's own little div.

    When I first put it up I thought, hey this is cool, and it works. And it stayed that way for months. All of a sudden I am getting complaints about that page.

    Come to find out it is only working in Fx. IE6, IE7, Safari (haven't tested opera) show the drop down box, let you choose a question but never display the answer.

    I can't for the life of me figure out why?

    Any help?

    The page is found here and all items are in the source code. I would really like to get this working again ASAP.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    May 2007
    Location
    Canada
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Appearantly IE(don't know about IE7) doesn't allow events on "option" element. You have to use "onchange" event in this case on your "select" element. I know it's painful.

    Here's a link that talks about it

    http://www.lattimore.id.au/2005/07/0...ript-solution/

    You can find more. Just google for events on "option" element

  3. #3
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I'm sorry, I don't speak Greek....
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Wha'? o.@
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Reading instructions in JS is like reading Charlie Brown's Teachers' lips...
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  6. #6
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Code:
    <script type="text/javascript">
    function showMe(selectMe) {
      document.getElementById("Q1").style.display = "none";
      document.getElementById("Q2").style.display = "none";
      document.getElementById("Q3").style.display = "none";
      document.getElementById("Q4").style.display = "none";
      document.getElementById("Q5").style.display = "none";
      document.getElementById("Q6").style.display = "none";
      document.getElementById("Q7").style.display = "none";
      document.getElementById("Q8").style.display = "none";
      document.getElementById("Q9").style.display = "none";
      document.getElementById("Q10").style.display = "none";
      document.getElementById("Q11").style.display = "none";
      document.getElementById("Q12").style.display = "none";
      document.getElementById("Q13").style.display = "none";
      document.getElementById("Q14").style.display = "none";
    if (selectMe != "selection") {
      document.getElementById(selectMe).style.display = "block";
    }
    }
    
    </script>
    
    <br><br>
    <select onChange="showMe(this.value)" name="menu" style='border: solid 1px #00CCCC; background-color: #CCCCCC; width: 85%; text-align: left; padding: 2px;'>
    <option value="selection">Select Question...</option>
    <option value="Q1">1) How do I look at the source code?</option>
    <option value="Q2">2) What are egg pages?</option>
    <option value="Q3">3) Will I need Photo Shop to complete this game?</option>
    <option value="Q4">4) How come, when I convert a file to the format it says I need, I still can't find the clues I am supposed to find?</option>
    <option value="Q5">5) I found a code, but I don't know how to decode it. Will someone tell me what it says so I can move on?</option>
    <option value="Q6">6) I don't know how to use [some program name]. Can someone tell me what I need to do?</option>
    
    <option value="Q7">7) I am not running a "required system" and I don't know how to find summary information on a file. Can someone just give me the answer?</option>
    <option value="Q8">8) Why are the hints in the threads so obscure?</option>
    <option value="Q9">9) Some of my forum posts now say "spoiler edit" in the place of some of my words. Am I in trouble for posting spoilers without meaning to?</option>
    <option value="Q10">10) I noticed my posts have disappeared and my post count has gone down. Why did my previous posts disappear?</option>
    <option value="Q11">11) CWoT is awesome! Can I be a Moderator too?</option>
    <option value="Q12">12) While searching the internet with the clues I found I came across a site that had the spoilers in it.What can be done?</option>
    <option value="Q13">13) Am I allowed to post links to other games in the CWoT forum?
    <option value="Q14">14) When I make a post or send a PM, Bubba Loves Me shows up in place of some of my words. Why?</option>
    </select>
    </p>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Ohh, I see what you did... So that's what they meant by hard coding the function? Interesting...

    I will give it a try! Thanks!

    Edit:
    That did the trick. Muchas Gracias!
    Last edited by BLiZZaRD; 01-12-2008 at 08:28 PM.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ow.
    Code:
    function showMe(selectMe) {
      for(var i = 1; i < 15; ++i)
        document.getElementById("Q" + i).style.display = "none";
    
      if (selectMe != "selection")
        document.getElementById(selectMe).style.display = "block";
    }
    No comments on whether this code is actually correct or not, just removing the redundancy.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •