SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prototype slide and <select> menu

    I have a div that's hidden on page load. When the user selects TV Shows from the select menu, I would like the "tele" div to slide in using the prototype slide effect. So far, I have it working EXCEPT for the slide part. The slide works, but it works on every menu selection. I only want it to work when TV Shows is selected. Just not sure how to do it.

    Code HTML4Strict:
    <script type="text/javascript">
    function toggleVisibility(oSelect) {
      var oDiv = document.getElementById("tele");
      oDiv.style.display = (oSelect.value == "TV Show")? "block" : "none";
      Effect.toggle('tele','slide'); // not sure how to implement this part
    }
    </script>
     
    <select name="kind" id="kind" onchange="toggleVisibility(this);">
      <option value="Movie" selected="selected">Movie</option>
      <option value="TV Show">TV Show</option>
      <option value="Music Video">Music Video</option>
    </select>
     
    <div id="tele">
    <!-- stuff here -->
    </div>

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by tgavin View Post
    The slide works, but it works on every menu selection. I only want it to work when TV Shows is selected. Just not sure how to do it.
    Code javascript:
    if (oSelect.value == 'TV Show') {
        // effect statement
    }
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard tgavin's Avatar
    Join Date
    Feb 2003
    Location
    FL
    Posts
    1,051
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pmw57 View Post
    Code javascript:
    if (oSelect.value == 'TV Show') {
        // effect statement
    }
    Ya know, before posting I had tested this by commenting out the 1st line, and the 2nd line, but not both the first AND second!

    Thanks


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
  •