dcsimg

Assignment 20: A Possible Answer

     The script used for this answer was taken straight from the primer you just read. Three changes were made:

  • A "prompt" command was added at the beginning of the function.
  • The TITLE command was broken into three parts so that the variable "name" could be added.
  • The color of the background was changed to green.

Here's what made it:

<SCRIPT LANGUAGE="JavaScript">

function openindex()
{

var name=prompt("What is your name?","Write it here")

var OpenWindow=window.open("", "newwin", "height=300,width=300,status=yes");

OpenWindow.document.write("<HTML>")
OpenWindow.document.write("<TITLE>")
OpenWindow.document.write("Hello " +name+ " Here is your window!")
OpenWindow.document.write("</TITLE>")
OpenWindow.document.write("<BODY BGCOLOR=green>")
OpenWindow.document.write("<CENTER>")
OpenWindow.document.write("<font size=+1>New Window</font><P>")
OpenWindow.document.write("<a href='' onClick='self.close()'>This closes the window</a><p>")
OpenWindow.document.write("</CENTER>")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")
}

</SCRIPT>

<body bgcolor="FFFFCC" onLoad="openindex()">

 

Did You Get It?

 

Back to the Index Page