SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Drop-Down Menu question

    Hi,

    I've got a drop down menu which grab it's values from a database. In this case, the values are actually Course names. Once the user selects a value a new window opens up with the additional course information. The problem is once the drop-down list is populated with the database values, if the user selects the first value that appears in the menu, no window will open. If the user wants to view those details, first he/she will have to select a value from down the list and then choose the first value again to see it's details.

    Here's the code I've used:

    Function

    function OpenNewWindow(myListBox) {
    var jumpToHere;
    var popUpWindow;
    var redir = myListBox[myListBox.selectedIndex].value;

    jumpToHere = 'coursedetails.asp?whereby=' + redir;
    popUpWindow = open(jumpToHere, "MyWindow", 'top=0,left=0,width=672,height=500,scrollbars=yes');
    }

    Code for Drop-down menu

    <select name="ID" id="dan" onchange="OpenNewWindow(this);this[0]" style="font-size:10pt; color:#000000"; size:"5" >
    <% while not RS.BOF AND not RS.EOF %>
    <option value="<%=RS("CourseID")%>"><%= RS("CourseName") %><%count = count + 1%></option>
    <%RS.movenext()
    wend
    RS.Close
    SET RS = nothing
    Conn.CLose
    Set Conn=nothing%> <% end if %>
    </select>

    or if you'd rather see the page it is here....

    http://www.moreton.tafe.net/courses.asp?Course=1

    As you can see, the menu has been populated with data already and if you try to view the details for "Certificate I and II in Vocational Access", nothing will happen.

    If anyone could help out, I would greatly appreciate it.

    Thanks,

    Daniel

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add this as the first option:
    <option>Please choose the course...</option>


  3. #3
    SitePoint Zealot kryptokid's Avatar
    Join Date
    Nov 2001
    Location
    Brisbane, Australia
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do'h! Thanks for your help, jofa. I actually had put something similar to that in there yesterday but it didn't work. Stupid me didn't realise that I had put it in the wrong place.


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
  •