two drop down list with javacript

W

weiwei

<% 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")%>"><%=rds.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>
 
W

web.dev

weiwei said:
<% 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")%>"><%=rds.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.
 
T

Thomas 'PointedEars' Lahn

web.dev said:
weiwei said:
[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.
 
W

web.dev

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

<!-- 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")%>"><%=rds.Fields("LocationName")%></option>
<% rds.movenext %>
<% Loop %>
<%
rds.Close
Set rds = Nothing
%>
Where is the closing said:
<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.
 
T

Thomas 'PointedEars' Lahn

[Forget about my other, accidental posting if you still see it]

web.dev said:
weiwei said:
[about 80 lines of full quote snipped]

You know what would be really nice? :)

If you learned how to quote properly?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top