Log In
Sign Up
Why Join Hot Scripts?
Hot Scripts
All Categories
PHP
Python
Tools & Utilities
XML
Ruby on Rails
Ajax
Web Hosting
ASP
ASP.NET
C & C++
CFML
Flash
Java
JavaScript
CGI & Perl
HTML5
Forums
Blog
Scripts
Hosted Apps
Plugins
Design Templates
Forum
Blog
Advertise
Contact Us
Register
FAQ
Rules
Calendar
Search
Today's Posts
Mark Forums Read
RSS Feeds
Current location:
Hot Scripts Forums
»
General Web Coding
»
JavaScript
» Validate Hyperlinks
Validate Hyperlinks
LinkBack
Thread Tools
Display Modes
#
1
(
permalink
)
08-28-09, 11:32 PM
silvercover
Wannabe Coder
Join Date: Aug 2004
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Validate Hyperlinks
Hi,
How can we validate entered links in forms using JavaScript? I also need it to be compatible with other languages such as Arabic and etc.
Thanks in advance.
silvercover
View Public Profile
Find all posts by silvercover
#
2
(
permalink
)
08-29-09, 07:39 AM
wirehopper
-
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
A regular expression is the best way to validate links in javascript.
You can probably find some good examples with a search engine.
wirehopper
View Public Profile
Find all posts by wirehopper
#
3
(
permalink
)
08-29-09, 09:22 AM
End User
Level II Curmudgeon
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
function CheckValidUrl(strUrl){
var RegexUrl = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return RegexUrl.test(strUrl);
}
or:
Javascript validate URL
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data
|
Oracle Date & Substring Functions
|
Code Snippet Library
| [url=http://www.codmb.com/Call Of Duty[/url]
End User
View Public Profile
Find all posts by End User
#
4
(
permalink
)
08-29-09, 09:54 AM
silvercover
Wannabe Coder
Join Date: Aug 2004
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you End User and wirehopper.
silvercover
View Public Profile
Find all posts by silvercover
Bookmarks
Digg
del.icio.us
StumbleUpon
Google
«
A simple JavaScript Shopping Cart
|
Accessing Tables with an id
»
Currently Active Users Viewing This Thread: 1
(0 members and 1 guests)
Thread Tools
Show Printable Version
Email this Page
Display Modes
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
BB code
is
On
Smilies
are
On
[IMG]
code is
Off
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
Forum Rules
Forum Jump
User Control Panel
Private Messages
Subscriptions
Who's Online
Search Forums
Forums Home
General Community
Announcements
Polls
The Lounge
New Members & Introductions
Script Requests
HotScripts.com Discussion
Hot Scripts Forum Questions, Suggestions and Feedback
General HotScripts Site Discussion
HotScripts Site Bug Reports
General Web Coding
HTML/XHTML/XML
HTML5
JavaScript
CSS
Flash & ActionScript
Programming Languages
PHP
Perl
ASP
ASP.NET
C/C++
Visual Basic
Windows .NET Programming
Everything Java
Other Languages
Other Discussions
Web Servers
Database
Other Topics
Web Design
API
Frameworks
AJAX
Security
Server Administration
Portable Device Programming
Cloud Computing
Ruby on Rails
CFML
Python
Tools and Utilities
Remotely Hosted
Web Hosting
Advertising Forums
General Advertisements
Job Offers & Assistance
Traffic Exchange
Website Reviews
Web Hosting Talk
DBForums.com
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
how to fix this case with hyperlinks...can u fix this problem
bilal_uettaxila
ASP.NET
3
02-04-08
04:58 AM
Dynamic Hyperlinks from Directory Contents
steve7005
PHP
2
01-31-08
07:32 AM
Some hyperlinks not working in IE
greymoose
HTML/XHTML/XML
2
11-13-06
01:15 AM
css hyperlinks
nick1
CSS
2
06-17-04
03:25 PM
Disable form fields to be submitted
RickyRod
JavaScript
2
05-24-04
10:15 AM
All times are GMT -5. The time now is
01:54 AM
.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
LinkBack
LinkBack URL
About LinkBacks
Bookmark & Share
Digg this Thread!
Add Thread to del.icio.us
Bookmark in Technorati
Share on Facebook
Share on Stumble Upon
Share on Twitter