SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot Drew630's Avatar
    Join Date
    Nov 2001
    Location
    Maryland
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Drop Down boxes revisited

    I used the solution that Vinny gave for drop-down boxes in an earlier thread. I wanted to maodify this to use radio buttons instead of boxes, because the boxes didn't give the feel that I was looking for. Using his code as a template, I was able to sidestep most issues, but I found a snag when I tried to change the value of and existing radio button. Perhaps I amd not doing it correctly, but here is what I have. Any help is welcome.

    <script>
    <!--
    function test(selVal, selName) {
    num = (parseInt(selName.substr(4)))
    num += (num %2 == 0) ? 1 : 2;
    nextSel = 'game' + num;
    document.picks.game3.value = selVal;
    if (document.layers) history.go(0)
    }
    //-->
    </script>

    <form name="picks" action="showpicks.asp"method="post">
    <input type="radio" name="game1" value="Team1"
    onClick="test(this.value, this.name);">Team1<br>
    <input type="radio" name="game1" value="Team2"
    onClick="test(this.value, this.name);">Team2<br>
    <br>
    <input type="radio" name="game2" value="Team3"
    onClick="test(this.value, this.name);">Team3<br>
    <input type="radio" name="game2" value="Team4"
    onClick="test(this.value, this.name);">Team4<br>
    <br>
    <input type="radio" name="game3" value="None">None<br>
    </form>
    ~Drew

    There Is No Greater Joy Than Soaring High On The Wings Of Your Dreams, Except Maybe The Joy Of Watching A Dreamer Who Has Nowhere To Land But In The Ocean Of Reality.

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Drew,

    I've got bad news for you. You cannot use my script with radio buttons, nor for that matter many other input types. To do what I did with selects requires dHTML for the other element types -- and sorry to say, it's too much work for me to bother with for free.

    If you really want to use radio buttons, you need to create x number of divs to hold the Team names, then you can change both the next radio button's value and the div's innerHTML to the previous radio button's value. When doing so, remember: radio buttons are an array, so you have game1[0].value and game1[1].value.

    If you want to learn dHTML, see "dHTML: an Introduction" script/tutorial at my site

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


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
  •