开发者

javascript error "invalid XML attribute value <script language=JavaScript>\n"

开发者 https://www.devze.com 2022-12-26 22:00 出处:网络
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 \"inva

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.


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.


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

<script language="JavaScript">

or

<script type="text/javascript">


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号