views:

288

answers:

3

i have some javascript files included in my html file for months. It used to work just fine until couple of days ago, now my scripts don't run anymore and i get javascript error "invalid XML attribute value <script language=JavaScript>\n" with firebug.

Does anyone know what this error means and how to get rid of it? i guess is something about that newline "\n" but i can't see that in my file if i open it.

+2  A: 

IIRC, language was never part of any specification, at least not in XHTML (And I think not in HTML, either.)

Try whether <script type="text/javascript"> works better.

Pekka
ok...now my line looks like this <script src="javascript/jquery.imageoverlay.js" type="text/javascript"></script>, and curiously i get same error ...
kmunky
It used to be!, was deprecated in HTML 4: http://www.w3.org/TR/REC-html40/interact/scripts.html
Nick Craver
@Nick Cheers for the info! @kmunky strange. Can you run your page(s) through a validator?
Pekka
omg...i can't get it work! @Pekka i've read that article, i have changed the doctype,i've included my scripts just like there....and...still same problem..
kmunky
@kmunky can you post the HTML before and after the script part please?
Pekka
actually i solved the problem. Weird, i found some "foreign" code in my .js files(at the bottom of my code) that started with "<script type=text/javascript>". How could that happen? maybe a virus on the server?
kmunky
@kmunky it's possible. What does the code do?
Pekka
i have no freakin' idea :D it looks something like some variables with some encoded values, nothing readable
kmunky
+1  A: 

Try to find that <script language=JavaScript> and replace with

<script language="JavaScript">

or

<script type="text/javascript">
KennyTM
A: 

The error is because of missing quotes on language=JavaScript, but as the other answers say, it's best to replace it with type="text/javascript" (including the quotes!)

Make sure to always put your attributes in quotes, in this case you would have gotten another validation error even after doing so, but in itself is still a validation error, more importantly, it's a validation error with very real side-effects in many cases.

Nick Craver
no, there are no missing quotes
kmunky