Previous Example-|-Next Example-|-Return to Chapter Listing

Example 14.13:
Embedding Images in the Document


Click on this button to open a window and write text to it, including an embedded image:

Click here to close the other window:


This is the script we used. In the HEAD... <SCRIPT LANGUAGE="JAVASCRIPT"> <!-- function OpenWindow() { Win1 = open("","SecWin","scrollbars=yes,width=600,height=350"); Win1.document.open(); Win1.document.write("<HEAD><TITLE>Image Document</TITLE></HEAD><IMG SRC='http://www.vmedia.com/u/pkent/bell.gif' WIDTH=144 HEIGHT=119 ALT='Wait a few moments and the Bell will appear...'><P>You have to do this just right, or the picture doesn't appear. Make sure you use the full URL of the picture--a relative URL may not be good enough. You should also include the image size; although it probably makes no difference to Netscape 3.0, earlier browsers may choke if you <I>don't</I> include the image size.<BR><FORM><input type='button' value='Close Window' onclick='window.close()'></FORM>") Win1.document.close() } function CloseWindow() { Win1.close() } //--> </SCRIPT> Then these buttons... <FORM> <input type="button" value="Open Window" onclick="OpenWindow()"><P> <I>Click here to close the other window:</I><P> <input type="button" value="Close Window" onclick="CloseWindow()"> </FORM>
Previous Example-|-Next Example-|-Return to Chapter Listing