Wall Script
Follow Me:
Tuesday, January 20, 2009

Twitter Like Parsing URLs with JavaScript.

This tutorial explains about how to Parsing URLs within the posted text like Twitter with Javascript. My last post I had included this Script. I was developing project I found this nice javascript prototype property script in mozilla labs site.

If you want to suggest any other alternate scripts, feel free post a comment.

Download Source Code     Live Demo

Method String.prototype property invoked parseURL. When called on a String the regular expression finds any case of a URL and will enclose the URL with a HTML anchor tag.
String.prototype.parseURL = function()
return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(url) {
return url.link(url);

Here we applying the parseURL() method to text variable called posted update contains a URL. But in database the update does not contain any anchor HTML tag.


<form action="" method="post">
<span class="what">What are you doing?</span>
<textarea  =""  cols="55" id="update" maxlength="145" name="update" rows="3"></textarea>
<input type="submit" value=" Update "  class="update_button" />


$sql="select * from updates order by ms_id desc";
$result = mysql_query($sql);

<script type="text/javascript">
var test = "<?php echo $message; ?>";// Variable text = Updates from the database

<a href="#" id="<?php echo $row["ms_id"]; ?>" class="delbutton"><img src="trash.png" alt="delete"/></a> </td></tr>


Download Source Code     Live Demo

If you want to suggest any other alternate scripts, feel free post a comment.

Related Posts :
Delete a Record with animation fade-out effect using jQuery and Ajax.
Anonymous said...


Anonymous said...

the demo isn't working............could you u please place it.....

Omprakash Bagrao said...

Demo Not working

Anonymous said...


Post a Comment