Tema: ugente xfa
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 28/02/2003, 08:35
Avatar de tunait
tunait
Moderadora
 
Fecha de Ingreso: agosto-2001
Ubicación: Terok Nor
Mensajes: 16.805
Antigüedad: 23 años, 6 meses
Puntos: 381
Bueno, ahí te dejo una solución en javascript.

Con esto mandará a la base de datos el contenido del textarea yá modificado con el html para que se cree automáticamente el enlace.

Código PHP:
<html>
<
head>
<
title>Untitled Document</title>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<
script language="Javascript">
function 
verificar(texto,donde)
{
pUrl = /^https?://[w.]+/
pUrl2 = /^[url]www.[/url][w]+.[w]+/
pMail = /^[w]+@[w]+.[w]+/
texto2 texto.split(/s/)
lar texto2.length
for(m=0;m<lar;m++)
    {
    if(
pUrl.test(texto2[m]))
        {
        
enlace '<a href="' texto2[m] + '">' texto2[m] + '</a>'
        
texto texto.replace(texto2[m],enlace)
        
donde.value texto
        
}
    if(
pUrl2.test(texto2[m]))
        {
        
enlace '<a href="http://' texto2[m] + '">' texto2[m] + '</a>'
        
texto texto.replace(texto2[m],enlace)
        
donde.value texto
        
}
    if(
pMail.test(texto2[m]))
        {
        
enlace '<a href="mailto:' texto2[m] + '">' texto2[m] + '</a>'
        
texto texto.replace(texto2[m],enlace)
        
donde.value texto
        
}
    }
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
  <textarea name="textfield" cols="50" rows="5" onBlur="verificar(this.value,this)"></textarea>
</form>
</body>
</html>