JavaScript won't allow pass HTML validation

Dear all, I got a question. Just want to make sure the my files validate. On one of the pages where I used JavaScript, it won’t validate and here are some of the mistakes the w3c states:

Line 20, Column 37: character “&” is the first character of a delimiter but occurred as data
else if (document.documentElement && document.documentElement.scrollTop)

If I change “&” in my embedded JavaScript into “&”, will the JavaScript still work the way it is meant?


Replying to my own post: just found I could //<![CDATA[ it, so I did that. But how do I work around the inline JavaScript?? No need to tell me inline is bad, i know that. but I have to deal with it for now. Any help with validating some of the inline JavaScript? Thanks.

The better way is to keep the JavaScript in its own separate file.