JavaScript не хорошо сформированная ошибка в для цикла

у кого-либо есть теория на объяснении для этого ограничения?

, Если позволяется быть просто теорией, моя теория состоит в том, что значения константы типов примитивов могут быть выражены по поводу литеральных параметров кода операции в MSIL..., но значения другого, нетипы примитивов не могут, потому что MSIL не имеет синтаксиса для выражения значения пользовательского типа как литерал.

6
задан Instance Hunter 4 November 2009 в 00:01
поделиться

4 ответа

You are using Javascript code in an HTML page claiming to be fully XHTML-compliant. Therefore, the < character cannot appear in the Javascript, as it would be interpreted as the beginning of an XHTML tag.

There are a number of ways to fix this.

You could change the DOCTYPE and make it not XHTML.
You could enclose the Javascript in a section.
You could move the Javascript into a separate .js file.
You could escape every occurrence of < with < and every & with &. I do not recommend this option; it'll make your code unreadable and will almost definitely not work in IE.

9
ответ дан 10 December 2019 в 00:40
поделиться

Likely your error isn't in this code, but something above it trickling errors down. So, instead of finding an error in this code, look above for malformed HTML or javascript that could be causing this error instead.

1
ответ дан 10 December 2019 в 00:40
поделиться

Works for me. Please post the full file, and make sure you are using script tags.

I posted a validating pastebin file (Chetan's was technically not valid), and it works fine with Firebug. So I suggest you come back with a full page of validating code that doesn't work.

0
ответ дан 10 December 2019 в 00:40
поделиться

If I use the following HTML and your text as "test.js", I too get no errors in Firebug.

<html>
<head>
    <script type="text/javascript" src="test.js"></script>
</head>
<body>
    test
</body>
</html>
0
ответ дан 10 December 2019 в 00:40
поделиться
Другие вопросы по тегам:

Похожие вопросы: