473,486 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

two drop down list with javacript

<% Option Explicit %>
<!--#include file="includes/conn.inc"-->
<% Dim rds, ID %>
<% Set rds = Server.CreateObject("ADODB.Recordset") %>
<% rds.Open "select RecID, LocationName from Location ORDER BY
LocationName", connStr, 3, 4 %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Location</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form){
var URL =
document.form.location_name.options[document.form.location_name.selectedIndex].value;
parent.mainframe.location.href = URL;
}
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form1){
var URL =
document.form1.location_network.options[document.form1.location_network.selectedIndex].value;
parent.mainframe.location.href = URL;
}
// End -->
</SCRIPT>
</HEAD>
</head>

<body bgcolor="ccccff">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="19%">&nbsp;</td>
<td width="55%"><font
size="3"><strong>Location</strong></font></td>
<td width="26%"><font size="3"><strong>Network
Subnet</strong></font></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11%">&nbsp;</td>
<td width="48%"><form name="form">
<SELECT NAME="location_name" onChange="javascript:formHandler()"> <div
align="center">
<% Do While NOT rds.EOF %>
<OPTION
value="redirect_loc.asp?ID=<%=rds("RecID")%>"><%=r ds.Fields("LocationName")%></option>
<% rds.movenext %>
<% Loop %>
<%
rds.Close
Set rds = Nothing
%>
</form></td>
<td width="41%"><form name="form1"><div align="center">
<% Dim rsd %>
<% Set rsd = Server.CreateObject("ADODB.Recordset") %>
<% rsd.Open "select RecID, Network from Location ORDER BY
Network", connStr, 3, 4 %>
<SELECT NAME="location_network" onChange="javascript:formHandler()">
<% Do While NOT rsd.EOF %>
<OPTION
value="redirect_network.asp?ID=<%=rsd("RecID")%>"> <%=rsd.Fields("Network")%></option>
<% rsd.movenext %>
<% Loop %>
<%
rsd.Close
Set rsd = Nothing
%>
</form></td>
</tr>
</table>
</body>
</html>

Nov 23 '05 #1
4 2238

weiwei wrote:
<% Option Explicit %>
<!--#include file="includes/conn.inc"-->
<% Dim rds, ID %>
<% Set rds = Server.CreateObject("ADODB.Recordset") %>
<% rds.Open "select RecID, LocationName from Location ORDER BY
LocationName", connStr, 3, 4 %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Location</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form){
var URL =
document.form.location_name.options[document.form.location_name.selectedIndex].value;
parent.mainframe.location.href = URL;
}
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form1){
var URL =
document.form1.location_network.options[document.form1.location_network.selectedIndex].value;
parent.mainframe.location.href = URL;
}
// End -->
</SCRIPT>
</HEAD>
</head>

<body bgcolor="ccccff">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="19%">&nbsp;</td>
<td width="55%"><font
size="3"><strong>Location</strong></font></td>
<td width="26%"><font size="3"><strong>Network
Subnet</strong></font></td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="11%">&nbsp;</td>
<td width="48%"><form name="form">
<SELECT NAME="location_name" onChange="javascript:formHandler()"> <div
align="center">
<% Do While NOT rds.EOF %>
<OPTION
value="redirect_loc.asp?ID=<%=rds("RecID")%>"><%=r ds.Fields("LocationName")%></option>
<% rds.movenext %>
<% Loop %>
<%
rds.Close
Set rds = Nothing
%>
</form></td>
<td width="41%"><form name="form1"><div align="center">
<% Dim rsd %>
<% Set rsd = Server.CreateObject("ADODB.Recordset") %>
<% rsd.Open "select RecID, Network from Location ORDER BY
Network", connStr, 3, 4 %>
<SELECT NAME="location_network" onChange="javascript:formHandler()">
<% Do While NOT rsd.EOF %>
<OPTION
value="redirect_network.asp?ID=<%=rsd("RecID")%>"> <%=rsd.Fields("Network")%></option>
<% rsd.movenext %>
<% Loop %>
<%
rsd.Close
Set rsd = Nothing
%>
</form></td>
</tr>
</table>
</body>
</html>


You know what would be really nice? :) If you provided us a question.
Otherwise, what do you want this group to do with your code? Where's
the problem? Otherwise, your html and your asp bits are useless.

Nov 23 '05 #2
web.dev wrote:
weiwei wrote:
[Fullquote]
You know what would be really nice? :) [...]If you provided us a

question. Otherwise, what do you want this group to do with your code? Where's
the problem? Otherwise, your html and your asp bits are useless.


Nov 23 '05 #3

weiwei wrote:
[snip]
<SCRIPT LANGUAGE="JavaScript"> The language attribute is deprecated. Use type attribute instead:

<script type = "text/javascript">
<!-- Begin HTML comment tags are unnecessary
function formHandler(form){ .... }
// End -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form1){ .... }
// End -->
</SCRIPT> You have two functions with the same name. The second function will
override the first one. Give them two different names. Then change
which function the onChange event handler calls.

[snip] <form name="form">
<SELECT NAME="location_name" onChange="javascript:formHandler()"> <div
align="center">
<% Do While NOT rds.EOF %>
<OPTION
value="redirect_loc.asp?ID=<%=rds("RecID")%>"><%=r ds.Fields("LocationName")%></option>
<% rds.movenext %>
<% Loop %>
<%
rds.Close
Set rds = Nothing
%> Where is the closing </select> tag? </form> <form name="form1"><div align="center">
<% Dim rsd %>
<% Set rsd = Server.CreateObject("ADODB.Recordset") %>
<% rsd.Open "select RecID, Network from Location ORDER BY
Network", connStr, 3, 4 %>
<SELECT NAME="location_network" onChange="javascript:formHandler()">
<% Do While NOT rsd.EOF %>
<OPTION
value="redirect_network.asp?ID=<%=rsd("RecID")%>"> <%=rsd.Fields("Network")%></option>
<% rsd.movenext %>
<% Loop %>
<%
rsd.Close
Set rsd = Nothing
%>

Again, where is the closing </select> tag?

[snip]

Hopefully, this will fix the problem you had, whichever that may be.

Nov 23 '05 #4
[Forget about my other, accidental posting if you still see it]

web.dev wrote:
weiwei wrote:
[about 80 lines of full quote snipped]
You know what would be really nice? :)


If you learned how to quote properly?

<http://jibbering.com/faq/faq_notes/pots1.html>
If you provided us a question.
Full ACK here.
[...] Otherwise, your html and your asp bits are useless.


They are useless. If the problem deals with server-side scripting, the
OP should show server-side JS code, not VBScript. If it deals with
client-side scripting, which can be assumed here, the OP should show the
code generated by the server, not the generating code on the server.
PointedEars
Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
14202
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want...
3
6135
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box...
13
5206
by: Leszek Taratuta | last post by:
Hello, I have several drop-down lists on my ASP.NET page. I need to keep data sources of these lists in Session State. What would be the most effective method to serialize this kind of data...
2
12594
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
1
2485
by: pmelanso | last post by:
Hello, I have a drop down list which is dynatically loaded from a database and I have a second drop down list that is also dynatically loaded depending on what is selected in the first drop down...
2
2485
by: weiwei | last post by:
<% Option Explicit %> <!--#include file="includes/conn.inc"--> <% Dim rds, ID %> <% Set rds = Server.CreateObject("ADODB.Recordset") %> <% rds.Open "select RecID, LocationName from Location ORDER...
8
7557
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID,...
5
18701
by: ashok893 | last post by:
I'm using two drop down list ina form. I have generated the first drop down list from MySQL database. When i select an option from first drop down list, i have to generate second drop down list...
4
9270
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
3
7326
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.