PullDown-Menü
Spakomat
- javascript
Guten Morgen,
ich habe vor, zwei verschiedene PullDown-Menüs auf einer Seite einzubauen. Das Problem ist, dass das zweite PullDown-Menü überhaubt keine Seite öffnet, bzw. immer nur die Seite öffnet, die zuvor im ersten PullDown-Menü geöffnet wurde. Ich habe den Quellcode mitkopiert. Ich schätze man muss noch eine zweite Funktion im Head-Bereich einfügen. Für eure Hilfe wäre ich euch sehr dankbar. Vielleicht weiß auch jemand wo man ein Beispiel dafür finden kann.
Herzliche Grüße
Spakomat
<html>
<head>
<script LANGUAGE="JavaScript">
<!-- Begin
function formHandler(){
var URL = document.schweisskoepfe.site1.options[document.schweisskoepfe.site1.selectedIndex].value;
window.location.href = URL;
// End -->
}
</script>
</head>
<body>
<table border="0" width="142">
<table>
<tr>
<td width="146" align="center">
<form name="schweisskoepfe">
<div align="center"><center><p align="center"><font face="Verdana"><b><select NAME="site1" SIZE="1"
onChange="formHandler()">
<option value="produkte_001.htm">Auswahl</option>
<option VALUE="produkte_002.htm">Schweißkopf A</option>
<option VALUE="produkte_011a.htm">Schweißkopf B </option>
<option VALUE="produkte_021a.htm">Schweißkopf C</option>
<option VALUE="produkte_031a.htm">Schweißkopf D</option>
</select></b></font></p>
</center></div>
</form>
</td>
</tr>
</table>
</table>
<table>
<table border="0" width="142">
<tr>
<td width="146">
<form name="loetkoepfe">
<div align="center"><center><p><font face="Verdana"><b><select NAME="site2" SIZE="1"
onChange="formHandler()">
<option value="produkte_001.htm">Auswahl</option>
<option VALUE="produkte_999">Laserlötkopf</option>
<option VALUE="produkte_998.htm">Lötkopf B </option>
<option VALUE="produkte_997.htm">Lötkopf C</option>
<option VALUE="produkte_996.htm">Lötkopf D</option>
</select></b></font></p>
</center></div>
</form>
</td>
</tr>
</table>
</body>
morgen auch,
es sollte schon reichen, wenn du beim 2ten pulldown den namen von
site2 auf site1 änderst.
<div align="center"><center><p><font face="Verdana"><b><select NAME="site2" SIZE="1" <----hier
onChange="formHandler()">
<option value="produkte_001.htm">Auswahl</option>
<option VALUE="produkte_999">Laserlötkopf</option>
<option VALUE="produkte_998.htm">Lötkopf B </option>
<option VALUE="produkte_997.htm">Lötkopf C</option>
<option VALUE="produkte_996.htm">Lötkopf D</option>
</select></b></font></p>
</center></div>
schau mal in deine funktion formhandler()
da steht das : [document.schweisskoepfe.site1.selectedIndex].value;
und das bezieht sich ja nnur auf "site1".
wenns nicht klappt, dann musst du die erste funktion formhandler kopieren, umbenennen und anpassen.
viel erfolg!
Moin !
Ich schätze man muss noch eine zweite Funktion im Head-Bereich einfügen. Für eure Hilfe wäre ich euch sehr dankbar.
Ja, hast Du denn Quelllcode denn gemopst oder was ? Wenn Du schon weißt, was Du machen mußt, warum tust Du's dann nicht einfach ?
<html>
<head>
<script LANGUAGE="JavaScript">
<!-- Begin
function formHandler() {
var URL = document.schweisskoepfe.site1.options[document.schweisskoepfe.site1.selectedIndex].value;
window.location.href = URL;
}
function formHandler2() {
var URL = document.schweisskoepfe.site2.options[document.schweisskoepfe.site2.selectedIndex].value;
window.location.href = URL;
}
// End -->
</script>
</head>
<body>
<table border="0" width="142">
<table>
<tr>
<td width="146" align="center">
<form name="schweisskoepfe">
<div align="center"><center><p align="center"><font face="Verdana"><b><select NAME="site1" SIZE="1"
onChange="formHandler()">
<option value="produkte_001.htm">Auswahl</option>
<option VALUE="produkte_002.htm">Schweißkopf A</option>
<option VALUE="produkte_011a.htm">Schweißkopf B </option>
<option VALUE="produkte_021a.htm">Schweißkopf C</option>
<option VALUE="produkte_031a.htm">Schweißkopf D</option>
</select></b></font></p>
</center></div>
</form>
</td>
</tr>
</table>
</table>
<table>
<table border="0" width="142">
<tr>
<td width="146">
<form name="loetkoepfe">
<div align="center"><center><p><font face="Verdana"><b><select NAME="site2" SIZE="1"
onChange="formHandler()">
^^ Hier noch eine "2" rein ...
also formHandler2()
<option value="produkte_001.htm">Auswahl</option>
<option VALUE="produkte_999">Laserlötkopf</option>
<option VALUE="produkte_998.htm">Lötkopf B </option>
<option VALUE="produkte_997.htm">Lötkopf C</option>
<option VALUE="produkte_996.htm">Lötkopf D</option>
</select></b></font></p>
</center></div>
</form>
</td>
</tr>
</table>
</body>
Ciao,
Harry
Öh ...
Ich übersah, daß Dein zweites Formular ja einen ganz anderen Namen hat ... d'Oh !
function formHandler2() {
var URL = document.schweisskoepfe.site2.options[document.schweisskoepfe.site2.selectedIndex].value;
window.location.href = URL;
}
function formHandler2() {
var URL = document.loetkoepfe.site2.options[document.loetkoepfe.site2.selectedIndex].value;
window.location.href = URL;
}
So isses richtig :-)
Ciao & Sorry,
Harry
(Korrekturnachlieferungsweltmeister)
Ich hab mich auch schon gewundert, dass es nicht geklappt hat. Vielen dank für eure schnelle Hilfe.
Einen schönen Tag noch
Spakomat