So I want to create a prompt that asks for a clients name. I want to make sure it is formatted in this way: "Last name, first name, middle initial" and no name longer than 20 characters. Here is what I have so far, but not sure where to go from here.
<script language="JavaScript">
//Get the name
var name = prompt("What is your Name?");
//validate
if(name)
//output
document.write ("That is your name! :)");
else
document.write ("Please use the format Last name, first name, middle initial");
</script>
document.writeis usually not a good idea. Also, is the 20 character limit based on the full name or each of the parts? What happens if someone does not have a middle name or surname?