scriptwelt.org das JavaScript Archiv

Navigation

Navigation Themenbereiche
Kontakt

eine Mail an ScriptWelt.org

Kontaktformular

Impressum
impressum

Grafik & Text JavaScript / Image View von Drop Down Menu aus

Das JavaScript öffnet eine Serie von Bildern, auf der selben Seite aus einem Drop Down Menu heraus. Die Liste ist leicht zu erweitern.
Autor: unbekannt

 


in <head> einfügen


<script language="JavaScript">
<!-- http://www.scriptwelt.org -->
<!--
var images = new Array(
"hier kommt der Pfad des Image rein ", "Bild 1 ",
"hier kommt der Pfad des Image rein" , "Bild 2"
);
</script>

in <body> einfügen
<script LANGUAGE="javascript">
<!--
function displayImage()
{
var IFname = document.f.s.options[document.f.s.selectedIndex].value;
document.im.src = IFname;
}
document.writeln('<IMG name="im" SRC="',images[0],'" BORDER=0>');
document.writeln('<form name="f" method="POST">');
document.writeln('<p><select name ="s" onChange ="displayImage()">');
document.write('<option selected value="',images[0],'"> ');
document.writeln(images[1],' </option>');
for (i=2; i<images.length; i+=2)
document.writeln('<option value="',images[i],'"> ',images[i+1],' </option>');
document.writeln('</select></p></form>');
//-->
</script>