Cut and Paste For Lesson 27c

It is important when copying JavaScript code not to pick up extraneous RETURN characters that you may get by using the versions displayed in the browser window. Use these examples to copy and paste successfully!

Select all of the HTML below, Copy, and then return to your HTML document to Paste the code.

c o p y   f r o m   h e r e



<SCRIPT LANGUAGE="JavaScript">
<!-- hide this script from old browsers

// This script opens a new browser window and writes
// HTML to display an image with a title and caption

function show_photo( pFileName, pTitle, pCaption) {

// specify window parameters
  photoWin = window.open( "", "photo", "width=600,height=450,status,scrollbars,resizable,screenX=20,screenY=40,left=20,top=40");

// wrote content to window
  photoWin.document.write('<html><head><title>' + pTitle + '</title></head>');	
  photoWin.document.write('<BODY BGCOLOR=#000000 TEXT=#FFFFCC LINK=#33CCFF VLINK=#FF6666>');
  photoWin.document.write('<center>');
  photoWin.document.write('<font size=+3 face="arial,helvetica"><b>' + pCaption + '</b></font><br>');
  photoWin.document.write('<img src="' + pFileName + '"><p>');
  photoWin.document.write('<font face="arial,helvetica">');	
  photoWin.document.write( '"' + pTitle + '" photo &copy; Lorrie Lava<br>');
  photoWin.document.write('<a href="mailto:lava@pele.bigu.edu">lava@pele.bigu.edu</a><br>');
  photoWin.document.write('Volcanic Studies, <a href="http://www.bigu.edu/">Big University</a>');
  photoWin.document.write('<p></font></body></html>');
  photoWin.document.close();	
	
// If we are on NetScape, we can bring the window to the front
	if (navigator.appName.substring(0,8) == "Netscape") photoWin.focus();

}
// done hiding from old browsers -->
</SCRIPT>



t o   h e r e


Writing HTML: Lesson 27c: JavaScript Window Openers
©1994-2002 Maricopa Center for Learning and Instruction (MCLI)
Maricopa Community Colleges
Questions? Comments? Visit our feedback center

URL: http://www.mcli.dist.maricopa.edu/tut/tut27c_ex/cut1.html


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.5 License.