<!-- JavaScript Assignment #3 Xiangjun Zhou // --> <html> <head> <title>Assignment #3</title> <script language="JavaScript"> <!-- hide me function targetPage(form) { newColor = (form.colorsList.options[form.colorsList.selectedIndex].text) if (targetwindow == null) { var targetwindow = window.open("","target","HEIGHT=300,WIDTH=200") } targetwindow.document.writeln("<HTML><BODY BGCOLOR=" + newColor + ">") targetwindow.document.writeln("<HEAD>") targetwindow.document.writeln("<TITLE>Image Swapping with Links</TITLE>") targetwindow.document.writeln("<SCRIPT LANGUAGE=\"JavaScript\">") targetwindow.document.writeln("var UpImg = new Image(163,88)") targetwindow.document.writeln("var DownImg = new Image(163,88)") targetwindow.document.writeln("UpImg.src = \"images/bup.gif\"") targetwindow.document.writeln("DownImg.src = \"images/bdown.gif\"") targetwindow.document.writeln("function setImage(type) {") targetwindow.document.writeln(" var imgFile = eval(type + \"Img.src\")") targetwindow.document.writeln(" document.images[\"LinkButton\"].src = imgFile") targetwindow.document.writeln(" return false") targetwindow.document.writeln("}") targetwindow.document.writeln("</SCRIPT>") targetwindow.document.writeln("</HEAD>") targetwindow.document.writeln("<BODY>") targetwindow.document.writeln("<CENTER>") targetwindow.document.writeln("<B>Target Window</B><HR>") targetwindow.document.writeln("<A HREF=\"javascript:void(0)\"") targetwindow.document.writeln(" onMouseDown=\"return setImage('Down')\"") targetwindow.document.writeln(" onMouseUp=\"return setImage('Up')\">") targetwindow.document.writeln("<IMG NAME=\"LinkButton\" SRC=\"images/bup.gif\" BORDER=0></A>") targetwindow.document.writeln("</CENTER>") targetwindow.document.writeln("</BODY>") targetwindow.document.writeln("</HTML>") targetwindow.document.close() } // end hide --> </script> </HEAD> <BODY> <FORM> <h3><font color=blue>This a control page <br> Choose a background color:</font></h3> <SELECT NAME="colorsList"> <OPTION SELECTED>Cornflower Blue <OPTION>Dark Salmon <OPTION>Light Goldenrod Yellow <OPTION>Sea Green <OPTION>Gray <OPTION>Lime <OPTION>Ivory <OPTION>Red </SELECT> <P> <INPUT TYPE="button" VALUE="Change It" onClick="targetPage(this.form)"> </FORM> </BODY> </HTML>