相片選擇器腳本 任意選擇圖片

- 中國WEB開發者網絡 (http://www.webasp.net)
-- 網頁特效 (http://www.webasp.net/javascript/)
--- 相片選擇器腳本 任意選擇圖片 (http://www.webasp.net/javascript/1/256.htm)
-- 發佈日期: 2004-07-03
<!-- 網頁特效代碼由[中國WEB開發者網絡:http://www.ChinaWebDev.com]提供! -->
<!-- 要實現此效果需要 2 個步驟: -->

<!-- 第 1 步: -->
<!-- 把下面的代碼加到<HEAD></HEAD>區域中: -->

<Script Language="JavaScript">
<!-- Begin
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=360,height=440 left=0 top=0");
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='關閉窗口' " +
"onClick='window.close()'></FORM>");
PreView.document.write("</CENTER>");
PreView.document.write("</BODY></HTML>");
PreView.document.close();
}
// End -->
</SCRIPT>




<!-- 第 2 步: -->
<!-- 把下面的代碼加到<BODY></BODY>區域中: -->

<FORM>
<select NAME="imagename" onChange="display_image(this.form)">
<option value="" SELECTED>請選擇相片
<option value="images/webasp.net.1.jpg">相片一
<option value="images/webasp.net.2.jpg">相片二
<option value="images/webasp.net.3.jpg">相片三
<option value="images/webasp.net.4.jpg">相片四
<option value="images/webasp.net.5.jpg">相片五
<option value="images/webasp.net.6.jpg">相片六
<option value="images/webasp.net.1.jpg">相片七

</select>
</FORM>

webasp.net