<html>
<head>
<title>alert & prompt </title>
<script type="text/javascript">
function check_form() {
var first_input = document.getElementById("one").value;
var second_input = document.getElementById("two").value;
if (first_input == " " || second_input == " ") {
alert('you need type something');
return false;
}
}
function greeting() {
var userName = prompt("What is your name?", "Enter your name here.");
if (userName) {
alert("It's good to meet you, " + userName + ".");
}
}
</script>
</head>
<body onLoad="greeting();">
<form name="example" onSubmit="return check_form()">
<input type="text" id="one" value=" "> </br>
<input type="text" id="two" value=" "> </br>
<input type="submit" value="send">
</form>
</body>
</html>