An alternative approach from Chris Ruck
that includes data checking
<html>
<head>
<script language="JavaScript">
function showname()
- {
- name = prompt("Enter Your Name","");
- while (name == "" || name == "null")
- {
- alert("YOU MUST ENTER A NAME");
- name = prompt("Enter Your Name","");
- }
- return name;
- }
</script>
:
:
:
:
:
<body bgcolor="gray">
<h1>Welcome to The Computer Purchase Helper</h1>
<p>
<script language="JavaScript">
- document.write(showname())
</script>
</body></html>
An Alternative from Sean Dulle
also including data checking
:
:
<script language="javascript" type="text/javascript">
- <!--
- reader = prompt("Please enter your name","");
- if (!reader) {
- reader = "Guest";
- }
- document.write("Welcome: <font class='guest'>" + reader + "</font>");
- -->
</script>
|