I am trying to open a new window with this code and assigning the variables to it, what am I doing wrong?
function writeToDocument() {
var textColor, backColor, pageTitle;
var yourText, pageContent, docWindow;
textColor = prompt("Please enter a text color:", "white");
backColor = prompt("Please enter a background color:", "black");
pageTitle = prompt("The page will be titled: ", "Default Title");
yourText = prompt("Add content to the new document:", "page content");
pageContent = "<html><head><title>";
pageContent += pageTitle + "</title>";
pageContent += "<script>alert('The page ' + document.title + ' was created: ' +
document.lastModified) < /script>";
pageContent += "</head><body><strong>";
pageContent += "</strong></body></html>";
var newWindow;
newWindow = open("", "docWin", "location=1");
newWindow.document.open();
newWindow.document.write(pageContent);
newWindow.document.write(background-color= backColor, color= textColor));
newWindow.document.close(); // Write your code here
}
I have tried multiple tutorials, but none of the methods worked.