Results 1 to 4 of 4

Thread: onClick to onSelect

  1. #1
    Join Date
    Apr 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default onClick to onSelect

    How do I edit this to make the popup open on selection instead of clicking a go button? Thanks!

    <form name="myform">
    <div align="center"><p><select name="dir" size="1">
    <option value="">Choose a Profile</option>
    <option value="yooper.htm">Yooper</option>
    <option value="antonov.htm">Antonov</option>
    <option value="fulcrum.htm">Fulcrum</option>
    <option value="oso.htm">Oso</option>
    <option value="nismo.htm">Nismo</option>
    <option value="smackdown.htm">Smackdown</option>
    </select><input type="button" name="button" value="Go!"
    onclick="openPop(this.form);"></p>
    </div>
    </form>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Try this demo out:

    HTML Code:
    <form name="myform">
    <div align="center"><p><select name="dir" size="1" 
    onChange="alert('You Chose '+this.form.dir.value);">
    <option value="">Choose a Profile</option>
    <option value="yooper.htm">Yooper</option>
    <option value="antonov.htm">Antonov</option>
    <option value="fulcrum.htm">Fulcrum</option>
    <option value="oso.htm">Oso</option>
    <option value="nismo.htm">Nismo</option>
    <option value="smackdown.htm">Smackdown</option></p>
    </div>
    </form>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by skinner69
    How do I edit this to make the popup open on selection instead of clicking a go button?
    To be honest, you shouldn't. I've debated this on Usenet before, so I'll just point to the relevant thread, rather than hash out the entire argument again.

    Quote Originally Posted by jscheuer1
    <select ... onChange="alert('You Chose '+this.form.dir.value);">
    Why go from a reference to the control, to the form, then back to the original control again? Using this.value is far more efficient and logical.

    Mike

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by Mike
    Why go from a reference to the control, to the form, then back to the original control again?
    No particular reason, I was just jumping off from the original markup/code that referenced it from a button not in 'dir'. Using this.value works fine here too.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •