Home | Registrieren | Einloggen | Suchen | Aktuelles


Forum » Auszeichnungssprachen » Javascript Problem in FF (IE funzt) mit dyn. füllen... Antworten
Javascript Problem in FF (IE funzt) mit dyn. füllenden Dropdowns !

Elharter
Feiertags-Poster


Beiträge: 26


Hallo liebes Forum,

leider habe ich ein Problem mit selbstfüllenden Dropdowns.

Ich möchte gerne 1 Dropdownmenü dynamisch füllen lassen, je nachdem was beim 1ten Dropdown ausgewählt wurde.
Also Dropdown 1 enhält Automarken, das 2te dann die Typen dazu.....

Wählt man zB im 1ten OPEL, wird das 2te nurmehr mit Vectra,Caravan, usw gefüllt....
wählt man hingegen Audi, dann wird das 2te mit 80,90,S8,A8 usw gefüllt.....

im IE funktioniert das ganze recht gut, leider im FF aber nicht wirklich.....weil das 2te Dropdown gar nicht gefüllt wird und ich ne Fehlermeldung erhalte.

Also, folgender Code im Body:

1: 
2: 
3:
<body onload="update_auswahl_marke_modell();">


hier lade ich das Javascript....dann kommt das JS:
1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
45: 
46: 
47: 
48: 
49: 
50: 
51: 
52: 
53: 
54: 
55: 
56: 
57: 
58: 
59: 
60: 
61: 
62: 
63: 
64: 
65: 
66: 
67:
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function update_auswahl_marke_modell()
{	
		document.getElementById('autotypen').innerHTML='<select name="autotype" width="150px" style="width:150px" class="pulldown"></select>';
		var markeAuswahl = document.forms.suche.automarke;
		var modellAuswahl = document.forms.suche.autotype;
		modellAuswahl.options.length = 0; // DropDown Menü entleeren
		
		if (markeAuswahl.options[markeAuswahl.selectedIndex].value == "0")
		{  // JS if ANFANG
		    //Modelle durchlaufen für die x. Marke 
		    modellAuswahl.options[0] = new Option("Typen...");
			
		for (i=0; i < modellAuswahl.options.length; i++)
		{			
		  if (modellAuswahl.options[i].text == "Typen...")
		  {
		  modellAuswahl.selectedIndex = i;
		  }
		}
		
		} // JS if ENDE
		
		<%
' Definiere SQL Statement:
 strSQL = "SELECT automarkeid,automarke FROM tbl_automarke ORDER BY automarke ASC"
 Set rs = Server.CreateObject("ADODB.Recordset")
 Set rs2 = Server.CreateObject("ADODB.Recordset")
 rs.open strSQL, strConnection
 do until (rs.eof)
 Response.Write("if (markeAuswahl.options[markeAuswahl.selectedIndex].value == """ & rs.fields("automarke") & """)" & vbcrlf)
  StrSql2 = "Select automarke_id, autotype FROM tbl_autotype Where automarke_id=" & rs("automarkeid") & " ORDER BY Autotype ASC"
  rs2.open StrSql2, strConnection
  if rs2.bof and rs2.eof then
   response.write (" { modellAuswahl.options[0] = new Option(""keine Type vorh."");")

  else
  zahl = 1
  response.write (" {" & vbcrlf & " modellAuswahl.options[" & 0 & "] = new Option(""Typen..."");" & vbcrlf)
  do until (rs2.eof)
   response.write (" modellAuswahl.options[" & zahl & "] = new Option(""" & rs2("autotype") & """);" & vbcrlf)
   zahl = zahl + 1
  rs2.movenext
  loop
  end if
  rs2.close %>
   for (i=0; i < modellAuswahl.options.length; i++)
		{			
		  if (modellAuswahl.options[i].text == "")
		  {
		  modellAuswahl.selectedIndex = i;
		  }	  
		}
		
		} // JS if ENDE
		<%
 rs.movenext
 loop
 rs.close   
 Set rs = Nothing
%>

} //function ENDE
</script> 



dann im HTML Teil lade ich das DIV um das Dropdown anzeigen zu lassen:
1: 
2: 
3:
<div id="autotypen" align="center"></div>


Wie bereits gesagt.......im IE funktioniert das, im FF erhalte ich diesen Fehler:

modellAuswahl has no properties

Ich verzweifle weider einmal ;((

Diese Nachricht wurde geändert von: Elharter
  Profil   Editieren   Zitieren

Elharter
Feiertags-Poster


Beiträge: 26


grml weis das niemand ;( ?

  Profil   Editieren   Zitieren
 

Antworten
Nach oben