Auswahlmenü mit javaScript im Formular funktioniert nicht?!
gustav
- javascript
Hallo,
ich habe das folgende Auswahlmenü, das allein super funktioniert, aber sobald ich es in einem Formular einfüge, funktioniert es nicht mehr, kann jemand mir vielleicht weiterhelfen?
Danke im Voraus.
Gruß
G.M.
UPS
ich habe das folgende Auswahlmenü, das allein super funktioniert, aber sobald ich es in einem Formular einfüge, funktioniert es nicht mehr, kann jemand mir vielleicht weiterhelfen?
hier ist der Code:
<script language="JavaScript">
<!--
function textValue(){
var stationInteger, stationString
stationInteger=document.stationform.stationselect.selectedIndex
stationString=document.stationform.stationselect.options[stationInteger].text
document.stationform.stationtext.value = "Das Ziel lautet: " + stationString +"!" }
//-->
</script>
<form name="stationform">
<div align="center"><center><p><select name="stationselect" onChange="textValue()"
multiple size="5">
<option>Feedback </option>
<option>Gästebuch </option>
<option>Links </option>
<option>Spiele </option>
</select> <br>
</p>
<div align="center"><center><p><input type="text" name="stationtext" value
size="40" maxlength="35"> </p>
</center></div>
</form>
Gruß
G.M.
Moin!
UPS
GottOhGott!
Schicke Dein "Formular" mal durch den Validator. Pass aber auf, daß der nicht abstürzt. Da sind eine Menge Tag's, die nicht geschlossen wurden etc. Vielleicht stolpert Dein Browser ja darüber.
Wenn's dann valide ist und immer noch nicht geht melde Dich nochmal.
MFFG (Mit freundlich- friedfertigem Grinsen)
fastix®
Hi,
das Problem ist, wenn ich es innerhalb eines Formular habe, bekomme ich das folgende JavaScript-Fehlermeldung:
Fehler: 'document.stationform.stationselect' ist Null oder kein Objekt
ansonsten, wenn es nicht innerhalb eines Formular steht funktioniert es einwandfrei, kann man eigentlich andere Möglichkeit als Formular nehmen?
Gruß
G.M.
das Problem ist, wenn ich es innerhalb eines Formular habe, bekomme ich das folgende JavaScript-Fehlermeldung:
Fehler: 'document.stationform.stationselect' ist Null oder kein Objekt
Da es in allen mir zur Verfügung stehenden Browsern einwandfrei läuft, hab ich für dein Problem nur eine Erklärung . Du mußt irgendwo einen ungültigen Zeilenumbruch drin haben, was von den Anderen bereits als 'open tags' moniert wurde !?
<html><head><title></title>
<script language="JavaScript">
function textValue()
{
var stationInteger, stationString;
stationInteger=document.stationform.stationselect.selectedIndex;
stationString=document.stationform.stationselect.options[stationInteger].text;
document.stationform.stationtext.value = "Das Ziel lautet: " + stationString +"!";
}
</script></head><body>
<div align="center">
<form name="stationform">
<select name="stationselect" onChange="textValue()" size="1">
<option>Feedback
<option>Gästebuch
<option>Links
<option>Spiele
</select><br><br>
<input type="text" name="stationtext" value size="40" maxlength="35">
</form>
</div></body></html>
So long !! :o)
Aber sobald ich das Ganze in einem anderen Formular stehen habe funktioniert es nicht, z.B.:
<html><head><title></title>
<script language="JavaScript">
function textValue()
{
var stationInteger, stationString;
stationInteger=document.stationform.stationselect.selectedIndex;
stationString=document.stationform.stationselect.options[stationInteger].text;
document.stationform.stationtext.value = "Das Ziel lautet: " + stationString +"!";
}
</script></head><body><form>
<div align="center">
<form name="stationform">
<select name="stationselect" onChange="textValue()" size="1">
<option>Feedback
<option>Gästebuch
<option>Links
<option>Spiele
</select><br><br>
<input type="text" name="stationtext" value size="40" maxlength="35">
</form>
</div></form></body></html>
und das ist genau mein Problem :o(
.. mal abgesehen davon, dass fastix vollkommen recht hat vonwegen ungeschlossener tags und js-befehle, funktioniert das script bei mir in dieser form sofort (ie 6 und moz 1.5).
es ist eigentlich auch kein fehler soweit im code zu entdecken.
ein sauberes coden bringt aber oft eine menge fehler erst gar nicht auf.
gruß hein