SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot grantus's Avatar
    Join Date
    Apr 2003
    Location
    TX
    Posts
    120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with jump menu CSS switcher

    I followed this tutorial:
    http://www.alistapart.com/articles/alternate/
    and it works great with the regular links:
    Code:
    <a href="#" onclick="setActiveStyleSheet('1'); return false;">1</a>
    <a href="#" onclick="setActiveStyleSheet('2'); return false;">2</a>
    <a href="#" onclick="setActiveStyleSheet('3'); return false;">3</a>
    However, instead of regular links, I'd prefer to have it in a jump menu. So I tried this:
    Code:
    <form>
    <select>
    <option value="1" selected="selected" onclick="setActiveStyleSheet('1')">1</option>
    <option value="2" onclick="setActiveStyleSheet('2')">2</option>
    <option value="3" onclick="setActiveStyleSheet('3)">3</option>
    </select>
    </form>
    and it works great in FF, Netscape, Opera, etc... but not IE.

    Now I'm just starting to learn some Javascript and I don't think I should have "onclick" with each <option> right?

    Or if anyone has a tutorial to a GOOD working jump menu CSS switcher that would be great.

    Thanks in advance.

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:

    HTML Code:
    <form>
    <select onchange="setActiveStyleSheet(this.value)">
    <option value="1" selected="selected">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </form>

  3. #3
    SitePoint Zealot grantus's Avatar
    Join Date
    Apr 2003
    Location
    TX
    Posts
    120
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweet! Works perfectly.

    Thanks for the help.


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
  •