I am practicing, well doing things the wrong way mostly.
I have a very simple script that generates a prompt window.
Instead of using a default text, I have left the text field empty.
However, I would like a default message to display in the pop up window if the user does not enter a value in the prompt box before clicking okay.
I tried adding a conditional statement but the default text does not write in the pop up window.
Here is the code:
function promptBox(){
var message = prompt("Who is your favorite Hollywood Star?", "");
newWindow = window.open('','','width=800,height=600');
newWindow.document.write(message);
newWindow.focus();
if ((prompt) == null);
document.write("No Value Entered");
}
function promptBox(){
var message = prompt("Who is your favorite Hollywood Star? ", "");
if (message == "")
message = "No Value Entered";
myWindow = window.open('','','width=800,height=600');
myWindow.document.write(message);
myWindow.focus();
}