Code:
<script>
// Sort Array (02-08-2005)
// by Vic Phillips http://www.vicsjavascripts.org.uk
function zxcSelectSort(zxcid,zxcfirstoption)
{
// zxcid - 'city'
// zxcfirstoption - '1'
zxcobj=document.getElementById(zxcid);
zxcAry=new Array();
for (zxc0=zxcfirstoption;zxc0<zxcobj.options.length;zxc0++)
{
zxcAry[zxc0-zxcfirstoption]=zxcobj.options[zxc0];
}
zxcAry=zxcAry.sort(zxcOptionSort);
for (zxc1=0;zxc1<zxcAry.length;zxc1++)
{
zxcobj.options[zxc1+zxcfirstoption]=new Option(zxcAry[zxc1].text,zxcAry[zxc1].value,true,true);
document.form.text.value=zxcAry[zxc1].text;
document.form.zxcobj.value=zxcobj;
}
}
function zxcOptionSort(zxca,zxcb)
{
zxcA=zxca.text.toLowerCase();
zxcB=zxcb.text.toLowerCase();
document.form.test.value = zxca.text
document.form.test2.value = zxcb.text
if (zxcA<zxcB)
{
return -1;
}
if (zxcA>zxcB)
{
return 1;
}
return 0;
}
</script>
<body bgcolor="#f5f5f5" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" onload="zxcSelectSort('city',1);">
<form name="form" id="form" method="post" action="destination4.asp">
<select name="city" id="city" style="font-size:9px" onChange="form.submit()">
<option value="empty"> </option>
<%
do until rscitycode.eof
set rsnotrains = con.execute("select DISTINCT Airportcode,CityCode from dbo_tp_airport where Citycode = '"& rscitycode("CityCode") &"' and Facilitycode = 'A'")
do until rsnotrains.eof
set rsnozug = con.execute("select DISTINCT CityName from dbo_tp_cityname where CityCode = '" & rsnotrains("CityCode") & "'")
do until rsnozug.eof
%>
<% if rsnozug("CityName") <> temp then %>
<option><%=rsnozug("CityName")%></option>
<%
end if
temp = rsnozug("CityName")
rsnozug.movenext
loop
rsnotrains.movenext
loop
rscitycode.movenext
loop
%>
</select>
</form>
I am having a wierd problem with this script.
When i INCLUDE the line:
Code:
document.form.zxcobj.value=zxcobj;
i get a 'null or not an object' error, but everything is passed to the next page and it works ok.
But when i take it out i get NO ERROR, but the following page (destination4.asp) doesnt work.
The 'city' form field is knocked out??
www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt