Comentarios sin revisar del artículo: Comprobar la validez de una URL con Ajax

1 comentario sin revisar
17/10/07

Por: Pepote
Creo que es complicarse un poco la vida. Se puede hacer sin Ajax.

El problema es que como Ajax está de moda, se utiliza para todo aún siendo innecesario.

La alternativa sin Ajax:

<html>
<head>
<script language='Javascript'>
function checkURL(){
var msURL=document.fichero.txturl.value;
var ifrURL=document.getElementById("ichkURL");
var dvURL=document.getElementById("divURL");
if (msURL.indexOf("http://") < 0)
document.fichero.txturl.value="http://"+msURL;

dvURL.innerHTML="<b>URL comprobada: "+document.fichero.txturl.value+"</b>";

ifrURL.style.display="inline";
ifrURL.width="100%";
ifrURL.height="50%";
ifrURL.src=document.fichero.txturl.value;
}

</script>
</head>
<body>
<table border="0" align="center">
<form name="fichero">
<tr>
<td align="right">URL:</td>
<td><input type="texto" name="txturl">
<input type="button" value="Comprobar URL" onclick="checkURL()">
</td>
</tr>
</form>
</table>
<br>
<div id="divURL" align="center"></div>
<iframe align="center" id="ichkURL" src="" width="0" height="0"></iframe>

</body>
</html>

Alojados en el grupo