Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/02/2012, 10:43
Avatar de lambar
lambar
 
Fecha de Ingreso: marzo-2005
Ubicación: Murcia Fumeta
Mensajes: 55
Antigüedad: 19 años, 2 meses
Puntos: 0
Respuesta: Validar y completar un campo url

Me gustaría una función mas elaborada pero me conformo con esto, para el que le pueda venir bien aquí la dejo.

Código:
	function boxToWeb() {
		var web = document.getElementById('eData_webEmp').value;
		if ( web.length > 5 ) {
			key = new Date(); idKey = key.getTime();
			URL = ( web.substr ( 0 , 7 ) == 'http://' ) ? web : 'http://' + web ;
			window.open(URL, idKey, 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width='+(screen.width-200)+',height='+(screen.height-200));
		}else alert ( 'Error n.012 \n La direccion web introducida no es válida. \n La URL debe contener más de 5 carácteres.' );
	}