missing } in XML expression error in javascript

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
lilyyanAsked:
Who is Participating?
 
hieloConnect With a Mentor 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 '}'
0
 
debuggerauConnect With a Mentor Commented:
looks fine to me, but its a function, not a XML expression...
0
 
b0lsc0ttConnect With a Mentor IT ManagerCommented:
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
0
 
lilyyanAuthor Commented:
hi, thanks for all replies. i just simply commented out the js file and the error is gone...
0
 
justforyou123Commented:
I wish I could comment out all my problems
0
All Courses

From novice to tech pro — start learning today.