http://learn.javascript.ru/play/T3ucBb
<!DOCTYPE HTML>
<html>
<head> </head>
<body>
<input id="url" type="text">
<input onclick="test()" type="button" value="test">
<script>
var url = document.getElementById('url');
function test() {
var v = url.value;
if(v.indexOf('http://') == v.indexOf('https://')) v = 'http://' + v;
alert(v);
}
</script>
</body>
</html>