Hello Dave,
On 15-Sep-99 11:38:46, you wrote:
>Would it be possible for a list of the elements of javascript which /are/
>present in the releases of Voyager 3? As I attempt to become proficient in
>coding Javascript it's a pain when I don't know whether it's my bad script or
>a lack of element in Voyager that's to blame. So I have to load the AWeb demo
>to check it out.
You may do that in the script at run time, therefore not relying on the
knowlegde of which browser you are supporting.
Let's say you have some code that could use regular expressions. You just
check if a string variable supports the search method and don't run the
code that relies on regular expressions and maybe run something else that
runs in browsers that support Javascript 1.0.
For instance, see this e-mail address validation function. If regular
expressions are not available so it isn't the search method of string
objects.
If this method is available, it is used to check a given string that is
taken from the value of the form field that we want to validate. If no,
some less strict code that works in JS 1.0 is used to rule out some kinds
of mistakes that the user may make when entering a e-mail address in the
form field. This is a better than nothing solution that works flawlessly
in any browser.
BTW, this code was generated by a form generating and validation class
written in the server side Web programming language named PHP. You may
find that class here:
http://phpclasses.UpperDesign.com/browse.html?package=1
If you care about these issues, the class also does PHP based server side
validation. But for e-mail addresses in particular I have another PHP
class that actually verifies if a mailbox of a given e-mail address exists.
That other class is available at:
http://phpclasses.UpperDesign.com/browse.html?package=13
function ValidateEmail(theinput)
{
s=theinput.value
if(s.search)
{
return (s.search(new
RegExp("^([a-z0-9_]|\-|\\\.)+@(([a-z0-9_]|\-)+\\\.)+[a-z]{2,4}$","gi"))>=0)
}
if(s.indexOf)
{
at_character=s.indexOf('@')
if(at_character<=0 || at_character+4>s.length)
return false
}
if(s.length<6)
return false
else
return true
}
Regards,
Manuel Lemos
Web Programming Components using PHP Classes.
Look at: http://phpclasses.UpperDesign.com/?[EMAIL PROTECTED]
--
E-mail: [EMAIL PROTECTED]
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--
____________________________________________________________
Voyager Mailing List - Info & Archive: http://www.vapor.com/
For Listserver Help: <[EMAIL PROTECTED]>, "HELP"
To Unsubscribe: <[EMAIL PROTECTED]>, "UNSUBSCRIBE"