missing } in XML expression error in javascript

lilyyan
lilyyan used Ask the Experts™
on
hello,

i consistently got an error in a simple js file :  missing } in XML expression

the js is:
function turnoff()
{
      document.getElementById('speaker').className='off';
      document.getElementById('video').className='off';
      document.getElementById('news').className='off';
      document.getElementById('event').className='off';
}

from firefox, the error is:  missing } in XML expression.

is there anything wrong in the above code?

Thanks so much for your help!
lilyyan
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
looks fine to me, but its a function, not a XML expression...
Commented:
Firefox would seem to be misinterpreting part of your code.  However I don't see an issue in the snippet you shared.  If you do have a simple example then post the complete page.  In some cases the line reported for the error is not really the cause.

bol
Expert of the Year 2008
Top Expert 2008
Commented:
The code you posted is not the problem. Check around the point where you are calling the function. If you are getting data via AJAX and using eval, make sure the data you are getting is "proper" javascript code. Meaning, look for missing/mismatched '}'

Author

Commented:
hi, thanks for all replies. i just simply commented out the js file and the error is gone...
I wish I could comment out all my problems

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial