NastyaNewer,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<div id="popup_contact" class="feedback popup_block">
<div class="form">
<form name="contact_form" action="#" method="post" class="form_main">
<label><input type="text" id="username" name="username" class="username field_name field"></label>
<label><input type="text" id="useremail" name="email" class="email_text field_email field" ></label>
<label><textarea class="space_message field_message field" name="message_people" id="message" rows="10"></textarea></label>
<label for="submit"></label>
<label><input type="submit" id="submit" value="Отправить" class="button_message"></label>
<label for="popup_contact" class="close_block"></label>
</form>
</div>
</div>
<script>
var form = document.contact_form;
form.addEventListener("submit", validForm, false);
function validForm(event) {
var valid = true,
border = "";
if (form.username.value == "") {
border = "2px solid red";
valid = false;
}
form.username.style.border = border;
border = "";
if (form.email.value == "") {
border = "2px solid red";
valid = false;
}
form.email.style.border = border;
if (!valid) {
event.preventDefault();
}
}
</script>
</body>
</html>