Id suggest the use of button with some tied javascript that searches the the textbox string and then writes out the matches as clickable links.

see below for a rough sample:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
var exp = /^[(((ht|f)tp(s?))\:\/\/)]*?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.([a-zA-Z]+)(\:[0-9]+)*(\/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$/;

var regex = new RegExp(exp);
regex.multiline = true;
regex.global = true;

function appendResult(str)
{
        var res = document.getElementById("result");
        res.innerHTML = res.innerHTML + '<br>' + str;
}
function clearResult()
{
        var res = document.getElementById("result");
        res.innerHTML ='';
}
function writeLinks(str)
{
        clearResult();
        aStrings = str.split(" ");
        for(var i=0; i < aStrings.length; i++)
        {
                var aMatches = regex.exec(aStrings[i]);
                if( aMatches != null)
appendResult('<a href="' + aMatches[0] +'" >' + aMatches[0] + '</a>');
                else
                        appendResult(aStrings[i]);
        }
}
</script>
</head>

<body>

<form name="form1" method="post" action="">
  <textarea name="myText" cols="30" rows="10"></textarea><br>
<input type="button" name="write" value="write" onClick="writeLinks(this.form.myText.value);">
  <div id="result">
</form>
</body>
</html>

Cheers

Pat

Palermo, Tiffany wrote:
Hi all,
How can you parse a url from a text area field, and render it as a hyperlink..

I am sick of copying and pasting the url into a browser window, I want the 
Hyperlink to be clickable, any code you guys can donate would be appreciated..



Regards.
Tiffany Palermo.

Disclaimer:
This overrides any disclaimer or statement of confidentiality that may be 
included on your message.




---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to