|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
JavaScript OnChange Help Required
Hi,
I am trying to get a list box to appear after a user has selected information from the first list box. I believe that I need some javascript onchange function. IS it possible to do this with posting the form, if it is please could someone help out with this problem. So after the user has selecting the room, another list box will appear with the serial nos of computers location in the room chosen by the user. <!--#include file="connectionstring.asp" --> <!--'Server side include used to hold the database connection details. Page 481 in Beginning ASP 3.0 book--> <!-- METADATA TYPE="typelib" 'This makes the ADO constants available without having to define them as constants. This information has been taken from page 519 of Beginning ASP 3.0 FILE="C:\Program Files\Common Files\System\ado\msado15.dll" --> <html> <head></head> <title>Test</title> <body> <% Dim strRoomNo Dim strSQL Dim strSQL1 strRoomNo = Request.Form("Location") 'Response.Write strRoomNo Dim strConnect Dim objRS ' Declare variable for recordset object Set objRS = Server.CreateObject("ADODB.Recordset") 'Create the the recordset object strSQL = "SELECT Computers.SerialNo FROM Computers WHERE Computers.RoomNo = '" & strRoomNo & "';" objRS.Open strSQL, strConnect Dim objRS1 ' Declare variable for recordset object Set objRS1 = Server.CreateObject("ADODB.Recordset") 'Create the the recordset object strSQL = "SELECT Computers.SerialNo FROM Computers WHERE Computers.RoomNo = '" & strRoomNo & "';" objRS1.Open strSQL1, strConnect %> <SELECT NAME="Location" SIZE="1"> <% Do While NOt objRS.EOF Response.Write "<OPTION VALUE='" & objRS("RoomNo") & "'>" & "<BR>" Response.Write objRS("RoomNo") & "</OPTION>" & "<BR>" objRS.MoveNext Loop objRS.Close Set objRS = Nothing %> </SELECT></B><BR><BR> <SELECT NAME="SerialNo" SIZE="1"> <% Do While NOt objRS1.EOF Response.Write "<OPTION VALUE='" & objRS1("SerialNo") & "'>" & "<BR>" Response.Write objRS1("SerialNo") & "</OPTION>" & "<BR>" objRS1.MoveNext Loop objRS1.Close Set objRS1 = Nothing %> </SELECT></B><BR><BR> </body> </html> Anyones help will be greatly appreciated. |
|
#2
|
||||
|
||||
|
Go here:
http://www.js-examples.com/example/?ex=97&mode=2 It has an example of how to hide items using javascript. View source. You can use this in conjunction with OnChange. |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > JavaScript OnChange Help Required |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|