FuncJS Library Docs

Select the documentation you want to view from the right hand panel below.

Select a page to view from the panel below. list of Functions 1. echo() - Nov 16 2012 2. print() - Nov 16 2012 3. function_exists() - Nov 16 2012 4. strlen() - Nov 16 2012 5. strpos() - Nov 16 2012 6. str_replace() - Nov 16 2012 7. findLast() - Nov 16 2012 8. up() - Nov 16 2012 9. down() - Nov 16 2012 10. storage() - Nov 17 2012 11. FormValidate() - Nov 16 2012 12. isset() - Nov 16 2012 13. changeTitle() - Nov 16 2012 14. str_rev() - Nov 16 2012 15. get() - Nov 16 2012 16. count() - Nov 16 2012 17. len() - Nov 16 2012 18. stripslashes() - Nov 16 2012 19. strip_tags() - Nov 16 2012 20. show_tags() - Nov 24 2012 21. split() - Nov 16 2012 22. grab() - Dec 15 2012 23. findLinks() - Nov 16 2012 MISCELLANEOUS 1. Get Started - Nov 14 2012 2. Functions in FuncJS - Nov 16 2012 3. Leave Feedback - Nov 02 2012
findLinks()
The findLinks() function let's you highlight links in a string, which start with "http" or "https", but some code modification can increase its capabilities.

The source code for this function was conceived through Sharikul Islam's PHP version at http://sniply.co/1e2e6c24ac.

Syntax:
findLinks(source);


Example:
<html>
<head>
<script type="text/javascript">
var string_with_links = "Follow FuncJS on Twitter at http://twitter.com/FuncJS";
var detect_links = findLinks(string_with_links);
echo(detect_links);
//this will output "Follow FuncJS on Twitter at <a href="http://twitter.com/FuncJS">http://twitter.com/FuncJS</a>"
</script>
</head>
</html>

Use the demo below to see how this function is going to function on a live webpage. Enter some words with at least one link (starting with "http" or "https") and click "Show links" to see the inputted text appear below with any links highlighted.




Source code for demo above:
<input type="text" id="text-with-links">
<input type="submit" id="show-links" value="Show links">
<div id="show-links-highlighted"></div>
<script>
grab('#show-links').addEventListener("click", function() {
if(grab('#text-with-links').value!==null) {
grab('#show-links-highlighted').innerHTML=findLinks(grab('#text-with-links').value);
} else {
return false;
}}, false);
</script>