вот код
<html>
<head>
<title>alert & prompt </title>
<script type="text/javascript">
function check_form() {
var valid = true;
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 valid;
}
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="check_form()">
<input type="text" id="one" value=" "> </br>
<input type="text" id="two" value=" "> </br>
<input type="submit" value="send">
</form>
</body>
</html>
пробовал твой способ разными сочетаниями.чет не выходит