Hi,
I wrote a function go that redirects you to the item you selected out of a drop down list. The function works perfect if you put it on a seperate page. If you put it in a page with another function, I get the message "document.frmBrowseByRegion has no properties."
I can't see any reason why this happens. I'll put the code underneath. Please help !!!
------ the script ----------
<Script language="JavaScript">
function goBrowseByRegion()
// Description: Select a continent out of the TravelguideDatabase
// Written: Jan Van Weert, 6 Nov 2000
// (c)2000 @itCONSULT
{
if (navigator.appName == "Netscape"
{
//document.frmBrowseByRegion.submit();
if (document.frmBrowseByRegion.optBrowseByRegion.options[document.frmBrowseByRegion.optBrowseByRegion.selectedIndex].value != 0)
{
var optBrowseByRegion = document.frmBrowseByRegion.optBrowseByRegion.options[document.frmBrowseByRegion.optBrowseByRegion.selectedIndex].value;
document.location.href="default.asp?iRegion=" + optBrowseByRegion
}
}
else
{
if (document.frmBrowseByRegion.optBrowseByRegion.value !=0)
{
var optBrowseByRegion = document.frmBrowseByRegion.optBrowseByRegion.value;
document.location.href="default.asp?iRegion=" + optBrowseByRegion
}
}
}
</Script>
------------ inside the body ---------
<table border="0">
<tr>
<td valign="bottom"><font size="-1">Browse Region</font></td>
</tr>
<tr>
<td valign="top">
<FORM STYLE="margin:0" NAME="frmBrowseByRegion" METHOD="POST">
<select name="optBrowseByRegion" onChange="javascript: goBrowseByRegion()">
<option value="" selected>Select Region</option>
<%Do While Not rstMajReg.EOF%>
<option value="<%=rstMajReg(0)%>"><%=rstMajReg(1)%></option>
<%
rstMajReg.MoveNext
Loop
%>
</select>
</FORM>
</tr>
</table>
I wrote a function go that redirects you to the item you selected out of a drop down list. The function works perfect if you put it on a seperate page. If you put it in a page with another function, I get the message "document.frmBrowseByRegion has no properties."
I can't see any reason why this happens. I'll put the code underneath. Please help !!!
------ the script ----------
<Script language="JavaScript">
function goBrowseByRegion()
// Description: Select a continent out of the TravelguideDatabase
// Written: Jan Van Weert, 6 Nov 2000
// (c)2000 @itCONSULT
{
if (navigator.appName == "Netscape"
{
//document.frmBrowseByRegion.submit();
if (document.frmBrowseByRegion.optBrowseByRegion.options[document.frmBrowseByRegion.optBrowseByRegion.selectedIndex].value != 0)
{
var optBrowseByRegion = document.frmBrowseByRegion.optBrowseByRegion.options[document.frmBrowseByRegion.optBrowseByRegion.selectedIndex].value;
document.location.href="default.asp?iRegion=" + optBrowseByRegion
}
}
else
{
if (document.frmBrowseByRegion.optBrowseByRegion.value !=0)
{
var optBrowseByRegion = document.frmBrowseByRegion.optBrowseByRegion.value;
document.location.href="default.asp?iRegion=" + optBrowseByRegion
}
}
}
</Script>
------------ inside the body ---------
<table border="0">
<tr>
<td valign="bottom"><font size="-1">Browse Region</font></td>
</tr>
<tr>
<td valign="top">
<FORM STYLE="margin:0" NAME="frmBrowseByRegion" METHOD="POST">
<select name="optBrowseByRegion" onChange="javascript: goBrowseByRegion()">
<option value="" selected>Select Region</option>
<%Do While Not rstMajReg.EOF%>
<option value="<%=rstMajReg(0)%>"><%=rstMajReg(1)%></option>
<%
rstMajReg.MoveNext
Loop
%>
</select>
</FORM>
</tr>
</table>