|
Posted by Manuel Lemos on 06/30/05 01:40
Hello,
on 06/29/2005 09:24 AM christian9997@hotmail.com said the following:
> We would be interested in hearing about the way people deal with
> javascript browser compatibility using PHP. There must be some much
> simpler ways of doing this but we are not sure how to do it.
Often is not a matter of dealing with browser differences but also
different Javascript versions in different versions of the same browser.
The most reliable way to solve that problem is to provide alternate
Javascript code that is conditionally executed at Javascript run time
depending on what the browser supports.
That is the solution used by this form validation class for instance to
validate e-mail addresses. If the regular expression objects are
available, it uses them, otherwise it uses a more basic type of e-mail
address validation:
http://www.phpclasses.org/formsgeneration
if(s.search)
{
return (s.search(new RegExp('email-regular-expression','gi'))>=0)
}
else
{
some other type of basic validation;
}
Regular expression detection support is made checking the existence of
the search method in the string object.
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Navigation:
[Reply to this message]
|