scriptwelt.org das JavaScript Archiv

Navigation
Startseite
Audio & Sound
Formulare
Cookies
Fenster & Frame
Grafik & Text
Navigation
Suche Scripts
Fun und Spiele
Buttons
Diverse
Tutorials

Kontakt
eine Mail an ScriptWelt.org
Webhosting
Tipps zur Providerwahl und zum Webspace

JavaScript in eine HTML Datei einbinden

Sind JavaScripts sicher?

Links zum Thema JavaSript

Impressum
impressum

Navigation JavaScript / DropDown Menü II

Dieses JavaScript stellt ein drei-faches Menu her. Das Menü funktioniert nach einer Logic, die es verhindert, daß im Menu Links doppelt angewählt werden.
Autor: Jay M. Rumsey
zur Demo

in <head> einfügen
<script type="text/javascript">
function NewList(selObj,newObj) {
var selElem = document.getElementById(selObj);
var selIndex = selElem.selectedIndex;
var newElem = document.getElementById(newObj);
var tmp = '';
newElem.options.length = 0;
for (var i=0; i<selElem.options.length; i++) {
tmp = selElem.options[i].value;
if (i != selIndex) { newElem.options[newElem.options.length] = new Option(tmp,tmp); }
}
}
</script>

in<body> einfügen
<table>
<tr>
<td>
<select id="SBox0" onclick="NewList('SBox0','SBox1')">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</td>
<td>
<select id="SBox1" onclick="NewList('SBox1','SBox2')">
<option value=""></option>
</select>
</td>
<td>
<select id="SBox2">
<option value=""></option>
</select>
</td>
</tr>
</table>