Meshok_smexa,
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script>
var flag = false;
function validate(){
if(flag) return true;
var y=document.forms['form']['http'].value;
//проверяем пункт 1
if (y.length==0){
document.getElementById('httpf').innerHTML='*I think someone does not want to work?';
return false;
}
var regexp = /^(((f|ht)tp(s)?):\/\/)?(www\.)?([a-zA-Z0-9\-]{1,}\.){1,}?([a-zA-Z0-9\-]{2,}\.[a-zA-Z0-9\-]{2,4}(\.[a-zA-Z0-9\-]{2,4})?)(\/|\?)?$/
//проверяем пункт 2
if (!regexp.test(y)){
document.getElementById('httpf').innerHTML='*not true! stop lying to me!';
return false;
}
//проверяем пункт 3
document.getElementById('httpf').innerHTML='pause';
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open('GET', y, false);
xmlhttp.onreadystatechange = update;
xmlhttp.send(null);
function update()
{
if (xmlhttp.readyState === 4 && xmlhttp.status === 200) {
flag = true;
//для проверки
document.forms['form'].submit()};
if (xmlhttp.readyState === 4 && xmlhttp.status === 404)
{document.getElementById('httpf').innerHTML='*false url';}
}
return false;
}
</script>
</head>
<body>
<form name='form' onsubmit='return validate()' action="" >
http:// <input type='text' name='http'> <span style='color:red' id='httpf'></span><br />
<input type='submit' value='send'>
</form>
</body>
</html>