function displayNewDocument() { document.open([averagempg], [gallonsofgas], [reservetank]); document.write(<html>); document.write('the values you input were '+ averagempg', ' + gallonsofgas +', and' reservetank); document.write(/html>); document.close(); } Code (markup): this doesnt open a document, plus i get an error saying displayNewDocument not defined! full script here: <html> <script type="text/javascript"> var averagempg; var gallonsofgas; var reservetank; var gallonsanswer; var answer; averagempg = prompt('Please enter your vehicles average mpg rating.'); gallonsofgas = prompt('Please enter the number of gallons of gasoline currently in your vehicle.'); reservetank = prompt('Please enter the number of gallons of gasoline in the reserve gas tank of your vehicle.'); averagempg = parseFloat(averagempg); gallonsofgas = parseFloat(gallonsofgas); reservetank = parseFloat(reservetank); gallonsanswer= gallonsofgas+reservetank; answer = averagempg * gallonsanswer; alert('With the available gas you have, you will be able to travel ' + answer + ' more miles.' ); function displayNewDocument() { document.open([averagempg], [gallonsofgas], [reservetank]); document.write(<html>); document.write('the values you input were '+ averagempg', ' + gallonsofgas +', and' reservetank); document.write(/html>); document.close(); } </script></head> <body onload="displayNewDocument()"> </body></html> Code (markup):