HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 20th, 2004, 04:45 PM
sunil sunil is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: UK
Posts: 16 sunil User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old January 20th, 2004, 11:40 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
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.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > JavaScript OnChange Help Required


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway