Results 1 to 2 of 2

Thread: Looking for a form effect

  1. #1
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Default Looking for a form effect

    Does anyone know if this is possible:

    I have a simple form with a select box that has three drop down options.

    e.g.
    HTML Code:
    <option value="one">One</option>
    <option value="two">Two</option>
    <option value="three">Three</option>
    This is what i'm trying to do:
    When someone selects option "two", another form field is then revealed.
    Would be nice if this could be done with some kind of transition effect - but not essential.
    Option "one" and "three" should have no effect.

    Presumabley I would need to do this with Javascript as the field would need to be revealed before the form was submitted.

  2. #2
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Here you go, it won't work in IE but thats IE's fault...for some reason onSelect and onFocus don't work on that field. Hmmmm, I never noticed. Anyways this code might work in IE 7 I'm not sure, I know it doesn't work in IE 6.

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function Num2() {
    document.getElementById("DIV").style.display='inline';
    }
    </script>
    </head>
    <body>
    <select>
    <option>1</option>
    <option onClick="Num2();">2</option>
    <option>3</option>
    </select>
    <br>
    <div id="DIV" style="background:#000000;display:none;color:#ffffff;">
    This is the test.
    </div>
    </body>
    </html>
    Best I could do, sorry.

    Tim

    EDIT: Just in case this wasn't clear, the extra form field would go in the DIV, or you could make a field and ID it. But make sure to change this reference:

    Code:
    getElementById("DIV")

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
  •