Useful JavaScript String Functions
page 3 of 3
by Taewook Kang
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 21841/ 33

Extract Links

 function listAllLinks( strSrc,blnClickable,optAtt ) {
//-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// listAllLinks function
// author: T. Kang
// contact: txkang@hotmail.com
// Extract every link in string and list them in order.
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
var arrAllLinks

if ( !blnClickable ) {
arrAllLinks = strSrc.match(/(https:\/\/|http:\/\/|ftp:\/\/|www.)([^\s]*)/gi );
return arrAllLinks.join( ',' );
}
else {
arrAllLinks = strSrc.match(/(https:\/\/|http:\/\/|ftp:\/\/|www.)([^\s]*)/gi );
return arrAllLinks.join( ',' ).replace( /(https:\/\/|http:\/\/|ftp:\/\/|www.)([^,]*)/gi,
'<a href=http://$2 ' + optAtt + '>$1$2</a>' );
}
}


View Entire Article

User Comments

Title: asd   
Name: asd
Date: 2012-08-02 10:36:03 AM
Comment:
asd
Title: Javascript ADO Connection Security Warning   
Name: Chetan
Date: 2009-02-10 5:28:03 AM
Comment:
We r use client side connection & we r face 1 problm that is "ADO Security Warning Trusted Site Click Ok & Click Cancel"



Plz reply
Title: Check Box List   
Name: Chetan
Date: 2009-02-06 3:38:10 AM
Comment:
How can get CheckBoxList Value & Text in JavaScript?

I Can Add CheckBoxList In aspx page C#.net. this CheckBoxList Details i bind from C#.net Code then I can Collected from JAVASCRIPT this Value & Text I want....




.....
Chetan
Title: simpler version of clickify (that works)   
Name: BC
Date: 2008-07-03 5:52:35 PM
Comment:
Hey commenters,

I found this other script which works like clickify. Clickify didn't work for me, but this one works out of the box:

http://www.codeproject.com/KB/scripting/replace_url_in_ajax_chat.aspx
Title: Does this work?   
Name: bitcloud
Date: 2008-07-03 5:48:23 PM
Comment:
I can't seem to get Clickify going at all... it just returns the same string... can you give an example usage?
Title: i want to see   
Name: francis
Date: 2007-10-11 7:52:11 AM
Comment:
how is i want to see the article
Title: How to use this?   
Name: SUNIL
Date: 2007-08-24 7:09:08 AM
Comment:
I ca'nt able to impliment, can u healp me?
Title: Very Helpful   
Name: David T.
Date: 2006-05-17 1:12:14 PM
Comment:
This is exactly what I was looking for! Saved me a ton of time. Thanks!
Title: w   
Name: w
Date: 2005-04-05 5:38:33 AM
Comment:
who create that function is seems to be brainish!

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-04-13 1:12:09 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search