topical media & game development
#javascript-code-05-url.js / js
// A generic function for checking to see if an input element has
// a URL contained in it
function checkURL( elem ) {
// Make sure that some text was entered, and that it's
// not the default http:// text
return !elem.value || elem.value == 'http://' ||
// Make sure that it looks like a valid URL
/^https?:\/\/([a-z0-9-]+\.)+[a-z0-9]{2,4}.*
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.