Home > Javascript > Add HTML while using window.open function in javascript

Add HTML while using window.open function in javascript

<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>
Advertisement
Categories: Javascript
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.