View Single Post
Old 06-30-2005, 12:05 AM   #8 (permalink)
awieds
Registered User
 
Join Date: Mar 2005
Posts: 42
awieds is on a distinguished road
Sorry...
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--#include file="../Connections/myConn.asp" -->
<%
Dim rs
dim strQuery
dim arrProducts()
dim arrDescription()
dim i
Set rs = Server.CreateObject("ADODB.Recordset")
strQuery="Select * from products" 
rs.Open strQuery, MM_myConn_STRING, 0, 2 ,1
while not rs.bof and not rs.eof
		redim preserve arrProducts(i)
		redim preserve arrDescription(i)
		arrProducts(i)=rs("ProductName")
		arrDescription(i)=rs("Description")
		i=i+1
		rs.movenext
wend
rs.Close()
set rs=nothing
%>
<script language="javascript">
<!--

function PopulateDesc(prod)
{
alert(prod);
}
</script>
</head>
<body>
<select name="products" id="products" language="javascript" onChange="PopulateDesc(myForm.products.value)">
<% dim j 
for j=lbound(arrProducts) to ubound(arrProducts)%>
<option value="<%=arrProducts(j)%>"><%=arrProducts(j)%> </option>
<%next%>
</select>
</body></html>
I am trying to get the product that the user selected. I have an alert in my javascript function to test it. It works fine, I got the product. Then I want to get the decription of that product and populate a textbox with it. I have made two parallel arrays in vbscript but how can I use the arrays in javascript or get the product into vbscript??
Thanks for any help!
awieds is offline   Reply With Quote