www.webdeveloper.com
Results 1 to 2 of 2

Thread: multiple forms

  1. #1
    Join Date
    Jan 2008
    Posts
    42

    multiple forms

    Hi,
    I have a drop down form that works nicely, but I want to have more than copy of it working on the same page. But I can't figure out how to make it work with more than one. I think is is an easy one for you gurus out there.

    <script>
    function goToNewPage0(dropdownlist)
    {
    var url = dropdownlist.options(dropdownlist.selectedIndex).value;
    if (url != "")
    {
    window.open(url);
    }
    }
    </script>
    <div class="post">
    <div class="entry">
    <p>Please select the number you require:</p>
    <form name="dropdown">
    <label><u>N</u>umber</label>
    <select name="list0" accesskey="N">
    <option selected>Please select one</option>
    <option value="#">1</option>
    <option value="#">2</option>
    <option value="#">3</option>
    <option value="#">4</option>
    <option value="#">5</option>
    <option value="#">6</option>
    <option value="#">7</option>
    <select>
    <input type=button value="Go" onclick="goToNewPage(document.dropdown.list)">
    </form>
    </div>
    </div>

    Many thanks in advanced

    Regards,

    Martin

  2. #2
    Join Date
    Nov 2010
    Posts
    1,085
    uh, you need to look at it in firebug. This is how the code you posted "should" look:

    Code:
    <script type="text/javascript">
    function goToNewPage(dropdownlist)
    {
    var url = dropdownlist.options[dropdownlist.selectedIndex].value;
    if (url != "")
    {
    window.open(url);
    }
    }
    </script>
    <div class="post">
    <div class="entry">
    <p>Please select the number you require:</p>
    <form name="dropdown">
    <label><u>N</u>umber</label>
    <select name="list" accesskey="N">
    <option selected>Please select one</option>
    <option value="#">1</option>
    <option value="#">2</option>
    <option value="#">3</option>
    <option value="#">4</option>
    <option value="#">5</option>
    <option value="#">6</option>
    <option value="#">7</option>
    </form>
    <input type="button" value="Go" onclick="goToNewPage(document.dropdown.list)">
    </div>
    </div>
    now what did you want to do?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles