scriptwelt.org das JavaScript Archiv

Navigation

Navigation Themenbereiche
Kontakt

eine Mail an ScriptWelt.org

Kontaktformular

Impressum
impressum

Grafik & Text JavaScript / Image mit Pop-Up anzeigen

Das JavaScript öffnet ein Bild mit einem Pop-up Fenster aus einem Drop Down Menu heraus.
Autor: unbekannt

 


in <head> einfügen


<script language="JavaScript">
<!-- http://www.scriptwelt.org -->
<!--
function display_image(form) {
selectionname = form.imagename.options[form.imagename.selectedIndex].text;
selection = form.imagename.options[form.imagename.selectedIndex].value;
PreView = window.open("", "Preview", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=200,height=255");
PreView.document.open();
PreView.document.write("<HTML><HEAD>");
PreView.document.write("<TITLE>Preview</TITLE>");
PreView.document.write("</HEAD><BODY BGCOLOR=FFFFFF TEXT=000000>");
PreView.document.write("<FORM><CENTER><B><FONT SIZE=+1>" +
selectionname + "</FONT></B><HR>");
PreView.document.write("<IMG HSPACE=0 VSPACE=0 " +
"SRC='" + selection + "'>");
PreView.document.write("<HR><FORM><INPUT TYPE='button' VALUE='Close' " +
"onClick='window.close()'></FORM>");
PreView.document.write("</CENTER>");
PreView.document.write("</BODY></HTML>");
PreView.document.close();
}
</SCRIPT>

in <body> einfügen
<FORM>
<select NAME="imagename" onChange="display_image(this.form)">
<option value="pic01.gif" SELECTED>Image 1
<option value="pic02.gif">Image 2
<option value="pic03.gif">Image 3
</select>
</FORM>