Onchange event of Dropdown box

Results 1 to 2 of 2

Thread: Onchange event of Dropdown box

  1. #1
    Sean Gallaghar Guest

    Default Onchange event of Dropdown box

    I have a dropdown box that i populate using a DSN connection. The onchange event of the select box, however, does not seem to be working right. Choosing a value from the dropdown box should take the user to a new page which populates a dropdown for the item selected on the current page.I would prefer to use the onchange event , as opposed to using a button.I already have a submit button on the first page which allows the user to type in something in a text box and then click the submit button. I guess i cant have two submit buttons on one page. I tried to add a button next to the dropdown box and used the "location="whatever.asp" function in JavaScript but it did not populate the dropdown on the next page.<BR><BR>Here&#039s the code:<BR><BR>The onchange funtion defined:<BR>-----------------------------------------------------------------<BR> &#060;script language="JavaScript"&#062;<BR><BR>&#060;!--<BR><BR>function gotohref(theSelect) {<BR>thehref = theSelect.options[theSelect.selectedIndex].value;<BR>window.location.href = "hospitals.asp";}<BR>-----------------------------------------------------------------<BR>the select box:<BR>-----------------------------------------------------------------<BR>&#060;select id=select1 name="hospitals1" onchange="gotohref(this);"&#062; <BR>-----------------------------------------------------------------<BR><BR>"hospitals.asp" is the name of the new(next) page.<BR><BR>There&#039s nothing wrong with the DSN connection.What could the problem be?<BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Onchange event of Dropdown box

    that code will take you to hospitals.asp whatever is selected.<BR><BR>shoudn&#039t you be appending the selected value onto the end of the href string???<BR><BR>j

Posting Permissions

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