
function replaceDocument() {
  // Set up default values for the parts of our story.
  var noun1 = "computer";
  var adj1 = "wicked neat";
  // Prompt for the various parts.
  noun1 = prompt('Enter a noun: ', noun1);
  adj1 = prompt('Enter an adjective: ', adj1);
  // Build a new document.
  var newdoc =
    '<html>\n' +
    '<head>\n' +
    '<title>Your Own Story</title>\n' +
    '</head>\n' +
    '<body>\n' +
    '<P>A story about a ' + adj1 + ' ' + noun1 + '.</P>\n' +
    '</body>\n' +
    '</html>\n';
  // Replace the document.
  document.clear();
  document.write(newdoc);
  document.close();
}
