java script
everthing is working expect what I want to do below:
I am trying to make it so that the little message box displays “why didnt you enter your name” if the user clicks CANCEL or simply clicks OK without putting in any data.
Here is the short script below, everthing else works but this little thing I am trying to do
<!testingscript language=”JavaScript”testing>
<!–
var name=prompt(“Could you please enter your first name here ?”,””);
if (name!=null&&name!=”How come you didnt put your name? Now please, click the refresh button on you screen above and try again, but this time enter your name ?”)
var today = new Date ()
var hrs = today.getHours();
document.writeln(“<b><font size=4 face=’Comic Sans MS’>”);
document.writeln(“<b>”);
if (hrs <= 12)
document.write(“Good Morning “+name+’!’);
else if (hrs <= 18)
document.write(“Good Afternoon “+name+’!’);
else
document.write(“Good Evening “+name+’!’); document.writeln(“<br>”);
// –>
<!/scripttesting>
I am on standby for an example script please, can someone give me an example of what I need to write out ?
Thank you so much……………….