jQuery: The Write Less, Do More JavaScript Library

JQuery animate wont work on Opera 9

View: New views
3 Messages — Rating Filter:   Alert me  

JQuery animate wont work on Opera 9

by Shabith Ishan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


hi!

Im new to jquery and my issue is jquery animate wont work in opera 9.
However its working perfectly on FF and Safari.

here is the code,

function ajaxpost()
{
        var errors =
MM_validateForm('txtName','','R','txtEmail','','RisEmail');
if(errors)
        {
  //alert( 'The following error(s) occurred:<br />'+errors);

                $('#contactform').animate({
                                        opacity:0,
                                        width:"0",
                                        },'slow',null,function(){
                $('#results').animate({
                                        opacity:100,
                                        width:"205px",
                                        background-image:"images/loading.gif",
                                        },'slow');


                        });
        }
else
        {
                //alert('ss');
        };

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var
i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain
an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a
number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is
required.\n'; }
    } if (errors) document.MM_returnValue = (errors == '');
        return(errors);
} }
};

thanks

Re: JQuery animate wont work on Opera 9

by Karl Swedberg-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi Shabith,

I see a few things that might be causing a problem:

1. You add a comma after the last item in each object literal. These  
commas should be removed (FF is more forgiving of such errors):

                $('#contactform').animate({
                                        opacity:0,
                                        width:"0", // <-- remove comma
                                        },'slow',null,function(){
                $('#results').animate({
                                        opacity:100,
                                        width:"205px",
                                        background-image:"images/loading.gif", <-- remove comma
                                        },'slow');

2. Background image isn't a property that can be animated with  
the .animate() method (at least not without the color plugin).  
Furthermore, if you are going to refer to a background image in an  
object literal, you need to either put background-image in quotes or  
use the DOM term, backgroundImage, instead. Finally, background image  
value should be written like url(path/to/file.gif)

3. I don't think the "null" argument is necessary. Not sure if it  
would cause problems, but it probably doesn't need to be there.

Hope that points you in the right direction.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On May 13, 2008, at 4:40 AM, Shabith Ishan wrote:

>
> hi!
>
> Im new to jquery and my issue is jquery animate wont work in opera 9.
> However its working perfectly on FF and Safari.
>
> here is the code,
>
> function ajaxpost()
> {
> var errors =
> MM_validateForm('txtName','','R','txtEmail','','RisEmail');
> if(errors)
> {
> //alert( 'The following error(s) occurred:<br />'+errors);
>
> $('#contactform').animate({
> opacity:0,
> width:"0",
> },'slow',null,function(){
> $('#results').animate({
> opacity:100,
> width:"205px",
> background-image:"images/loading.gif",
> },'slow');
>
>
> });
> }
> else
> {
> //alert('ss');
> };
>
> function MM_validateForm() { //v4.0
>  if (document.getElementById){
>    var
> i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
>    for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
> val=document.getElementById(args[i]);
>      if (val) { nm=val.name; if ((val=val.value)!="") {
>        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
>          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain
> an e-mail address.\n';
>        } else if (test!='R') { num = parseFloat(val);
>          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
>          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
>            min=test.substring(8,p); max=test.substring(p+1);
>            if (num<min || max<num) errors+='- '+nm+' must contain a
> number between '+min+' and '+max+'.\n';
>      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is
> required.\n'; }
>    } if (errors) document.MM_returnValue = (errors == '');
> return(errors);
> } }
> };
>
> thanks


Re: JQuery animate wont work on Opera 9

by Shabith Ishan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


hi karl,

thank you for your support. it did the trick!
thanks again.

Shabith Ishan



On May 13, 6:01 pm, Karl Swedberg <k...@...> wrote:

> Hi Shabith,
>
> I see a few things that might be causing a problem:
>
> 1. You add a comma after the last item in each object literal. These
> commas should be removed (FF is more forgiving of such errors):
>
>                 $('#contactform').animate({
>                                         opacity:0,
>                                         width:"0", // <-- remove comma
>                                         },'slow',null,function(){
>                 $('#results').animate({
>                                         opacity:100,
>                                         width:"205px",
>                                         background-image:"images/loading.gif", <-- remove comma
>                                         },'slow');
>
> 2. Background image isn't a property that can be animated with
> the .animate() method (at least not without the color plugin).
> Furthermore, if you are going to refer to a background image in an
> object literal, you need to either put background-image in quotes or
> use the DOM term, backgroundImage, instead. Finally, background image
> value should be written like url(path/to/file.gif)
>
> 3. I don't think the "null" argument is necessary. Not sure if it
> would cause problems, but it probably doesn't need to be there.
>
> Hope that points you in the right direction.
> --Karl
> _________________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On May 13, 2008, at 4:40 AM, Shabith Ishan wrote:
>
> > hi!
>
> > Im new to jquery and my issue is jquery animate wont work in opera 9.
> > However its working perfectly on FF and Safari.
>
> > here is the code,
>
> > function ajaxpost()
> > {
> >    var errors =
> > MM_validateForm('txtName','','R','txtEmail','','RisEmail');
> > if(errors)
> >    {
> >            //alert( 'The following error(s) occurred:<br />'+errors);
>
> >            $('#contactform').animate({
> >                                    opacity:0,
> >                                    width:"0",
> >                                    },'slow',null,function(){
> >            $('#results').animate({
> >                                    opacity:100,
> >                                    width:"205px",
> >                                    background-image:"images/loading.gif",
> >                                    },'slow');
>
> >                    });
> >    }
> > else
> >    {
> >            //alert('ss');
> >    };
>
> > function MM_validateForm() { //v4.0
> >  if (document.getElementById){
> >    var
> > i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
> >    for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
> > val=document.getElementById(args[i]);
> >      if (val) { nm=val.name; if ((val=val.value)!="") {
> >        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
> >          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain
> > an e-mail address.\n';
> >        } else if (test!='R') { num = parseFloat(val);
> >          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
> >          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
> >            min=test.substring(8,p); max=test.substring(p+1);
> >            if (num<min || max<num) errors+='- '+nm+' must contain a
> > number between '+min+' and '+max+'.\n';
> >      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is
> > required.\n'; }
> >    } if (errors) document.MM_returnValue = (errors == '');
> >    return(errors);
> > } }
> > };
>
> > thanks