Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code is OK in IE but not Netscape :( 1

Status
Not open for further replies.

Samoyed

Programmer
Jul 13, 2001
17
CA
Hi, I have a simple asp page which allows you to select something from one combo box, then that fills another one at the same time appending the selection in the url. This works fine in IE, but not Netscape. The files are located here
Can someone please have a quick glance over my code and tell me what I can do. In my SelectHomes.asp page i have the following code: (thanx in advance)
<!-- #include file = &quot;ADOVBS.INC&quot; -->

<HTML>

<%

strProvSelected=Request.QueryString(&quot;prov&quot;)


AccessConnectionString = &quot;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=&quot; _
& server.mappath(&quot;Quiz2DB_b2000.mdb&quot;) & &quot;;uid=;password=;&quot;

Set dbConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
dbConn.Open AccessConnectionString

%>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

function changeCities(){


scriptProvince=document.chooseCity.select1.value;

document.all[&quot;chooseCity&quot;].action=&quot;SelectHomes.asp?prov=&quot;+scriptProvince;
document.all[&quot;chooseCity&quot;].submit();
}

function changeListings(){

scriptCity=document.chooseCity.select2.value;
document.all[&quot;chooseCity&quot;].action=&quot;DisplayListings.asp&quot;;
document.all[&quot;chooseCity&quot;].submit();
}

</SCRIPT>

<BODY bgColor=&quot;#fff8dc&quot;>

<h1>Find and Compare Homes</H1>

<FORM name=&quot;chooseCity&quot; method=&quot;post&quot; action=&quot;SelectHomes.asp&quot;>

<% if strProvSelected=&quot;Alberta&quot; then%>

<SELECT name=&quot;select1&quot; STYLE=&quot;WIDTH:220&quot; onchange=&quot;changeCities(this)&quot;>
<OPTION VALUE=&quot;Alberta&quot; selected>Alberta</OPTION>
<OPTION VALUE=&quot;British Columbia&quot;>British Columbia</OPTION>
</SELECT>

<%else
'when the pg is first loaded, the code below is displayed
'with BC as the default selection%>

<SELECT name=&quot;select1&quot; STYLE=&quot;WIDTH:220&quot; onchange=&quot;changeCities(this)&quot;>
<OPTION VALUE=&quot;Alberta&quot; >Alberta</OPTION>
<OPTION VALUE=&quot;British Columbia&quot; selected>British Columbia</OPTION>
</SELECT>

<%end if

Set rsCities = Server.CreateObject(&quot;ADODB.Recordset&quot;)

rsCities.Filter = &quot;Province='&quot; & strProvSelected & &quot;'&quot;
'if the above filter is used, it chooses everything in the city
'table where the Province is the one chosen
rsCities.Open &quot;Select * from Cities&quot;, dbConn, adOpenStatic, adLockOptimistic, adCmdText
'then it selects all those records, and since there is > 1, it needs loop
optionCount=0

Response.write (&quot;<Select name='select2' STYLE='WIDTH:220'>&quot;)
While not rsCities.EOF
Response.write(&quot;<Option Value='&quot; & rsCities(&quot;Cities&quot;) & &quot;'>&quot; & rsCities(&quot;Cities&quot;) & &quot;</Option><BR>&quot;)
rsCities.Movenext
Wend

Response.write (&quot;</Select><br><br>&quot;)

%>

<input type=&quot;button&quot; value=&quot;Submit&quot; style=&quot;width:200&quot; onclick=&quot;changeListings()&quot;>

</form>
</BODY>
</HTML>
 
document.all is an IE extension to the DOM and it is not supported by N. The first few places where you use it can easily be revised to work in both browsers.

Code:
document.chooseCity.action = =&quot;DisplayListings.asp&quot;;
document.chooseCity.submit();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top