I need to fill an option list with an array and the only thing I've been able to find is to use javascript, except I can not get js to use my array made in vbs.
can someone please help or point me in a direction that will work. The following is my code so far.
Thanks in advance
Peter X-)
<title>Test page</title>
<script language="javascript">
function clearList(list)
{
var i = 0;
var o = list.options;
for (i = o.length; i >= 0; --i)
o = null;
list.disabled = true;
}
function addElement(list, text_in, value_in)
{
var o = list.options;
var nIdx;
if (o.length < 0) //IE for Mac 4.5 sets length to -1 if list is empty
nIdx = 0;
else
nIdx = o.length;
o[nIdx] = new Option(text_in, value_in);
}
</script>
</head>
<body>
<form name="storysubmit">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="31%"><select size="1" name="neNetType" onChange="GetTopics(this);">
<option></option>
<option value="Agnet">Agnet</option>
<option value="FSNet">FSNet</option>
<option value="AnimalNet">AnimalNet</option>
<option value="BioEdNet">BioEdNet</option>
</select></td>
<td width="69%"></td>
</tr>
<SCRIPT LANGUAGE="JavaScript">
function GetTopics(SelectNet){
<% 'open the data connection %>
<!--#include file="./opendatabase.asp"-->
<% dim arrTopics
'SQL query to the database...
SQL = "SELECT Topic FROM Topics" %>
<!--#include file="./opensql.asp"-->
<% if not rs.eof then
arrTopics = rs.getrows()
arrTopicsCount = Ubound(arrTopics)
Else
arrTopicsCount = -1
End IF
%>
clearList(document.storysubmit.neTopic);
addElement(document.storysubmit.neTopic, arrTopics, arrTopics);
}
</script>
<tr>
<td width="31%"><select size="1" name="neTopic">
<option value="-1">Choose Net Type</option>
</select></td>
<td width="69%"></td>
</tr>
<tr>
<td width="31%"></td>
<td width="69%"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></td>
</tr>
</table>
</form>
</body>
</html>
can someone please help or point me in a direction that will work. The following is my code so far.
Thanks in advance
Peter X-)
<title>Test page</title>
<script language="javascript">
function clearList(list)
{
var i = 0;
var o = list.options;
for (i = o.length; i >= 0; --i)
o = null;
list.disabled = true;
}
function addElement(list, text_in, value_in)
{
var o = list.options;
var nIdx;
if (o.length < 0) //IE for Mac 4.5 sets length to -1 if list is empty
nIdx = 0;
else
nIdx = o.length;
o[nIdx] = new Option(text_in, value_in);
}
</script>
</head>
<body>
<form name="storysubmit">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="31%"><select size="1" name="neNetType" onChange="GetTopics(this);">
<option></option>
<option value="Agnet">Agnet</option>
<option value="FSNet">FSNet</option>
<option value="AnimalNet">AnimalNet</option>
<option value="BioEdNet">BioEdNet</option>
</select></td>
<td width="69%"></td>
</tr>
<SCRIPT LANGUAGE="JavaScript">
function GetTopics(SelectNet){
<% 'open the data connection %>
<!--#include file="./opendatabase.asp"-->
<% dim arrTopics
'SQL query to the database...
SQL = "SELECT Topic FROM Topics" %>
<!--#include file="./opensql.asp"-->
<% if not rs.eof then
arrTopics = rs.getrows()
arrTopicsCount = Ubound(arrTopics)
Else
arrTopicsCount = -1
End IF
%>
clearList(document.storysubmit.neTopic);
addElement(document.storysubmit.neTopic, arrTopics, arrTopics);
}
</script>
<tr>
<td width="31%"><select size="1" name="neTopic">
<option value="-1">Choose Net Type</option>
</select></td>
<td width="69%"></td>
</tr>
<tr>
<td width="31%"></td>
<td width="69%"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></td>
</tr>
</table>
</form>
</body>
</html>