0 Пользователей и 1 Гость просматривают эту тему.
  • 9 Ответов
  • 1903 Просмотров
*

Kentuki777

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
После валидации на http://validator.w3.org/ главной страницы, ему не понравилась строка кода:
Код
$jsVars .= 'faceboxHtml = \'<div id="facebox" style="display:none;"><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div></div>\' '."\n";

Он на нее ругается следующим образом: document type does not allow element "div" here
Цитировать
…div id="facebox" style="display:none;"></div><div class="popup"><div class="co…

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Вопрос: как правильно эту строку кода переписать?
*

alex38ann

  • Захожу иногда
  • 204
  • 7 / 0
  • www.sn38.ru
не понятно почему ругается, строка написана правильно. возможно где то дальше в коде модуля есть какая то не состыковка.
была похожая проблема на одном сайте, валидатору тоже не нравился код в котором было много тегов <tr> <td>. проверяли не однократно весь код, проблем обнаружено не было, заменили таблицы дивками, проблема пропала.
*

Kentuki777

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
Если строка написана верно, получается ему не нравится, что div используется именно в этом месте и "происходит некорректное наследование у элементов - style в body вместо head (или два элемента перекрываются).". Вот весь текст страницы
Спойлер
[свернуть]
*

Kentuki777

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
И еще один вопрос поважнее:

Error Line 35, Column 150: end tag for element "div" which is not open
…popup"><div class="content"></div> <a href="#" class="close"></a></div></div>'

The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

Все таже строка :
Код
faceboxHtml = '<div id="facebox" style="display:none;"><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div>' 

Подскажите, пожалуйста, что он считает лишним закрывающим div'ом?
*

alex38ann

  • Захожу иногда
  • 204
  • 7 / 0
  • www.sn38.ru
походу его не устраивает то что в этой строке открывается 3 дива, а закрывается только 2
*

Kentuki777

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
Это очень странно, так как вся строка целиком следующая:
Код
faceboxHtml = '<div id="facebox" style="display:none;"></div><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div></div>'
*

evgen777

  • Давно я тут
  • 657
  • 62 / 2
так правильно все, у вас один лишний div
faceboxHtml = '<div id="facebox" style="display:none;"></div><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div></div>'
Разработка, доработка расширений для Joomla!
*

Kentuki777

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
А да, точно :)
*

Kentuki777

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
Так... но вопрос об ошибке document type does not allow element "div" here все еще актуален... доктайп XHTML 1.0 strict.
Код
$jsVars .= 'faceboxHtml = \'<div id="facebox" style="display:none;"><div class="popup"><div class="content"></div> <a href="#" class="close"></a></div></div>\' '."\n";
и ответ валидатора...
Цитировать
…div id="facebox" style="display:none;"></div><div class="popup"><div class="co…

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
*

Kentuki777

  • Осваиваюсь на форуме
  • 10
  • 0 / 0
Удалось выяснить в чем причина: доктайп не позволяет div в head. Можно ли как то переписать код, чтобы все это дело выводилось в body?
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Кнопка “Добавить в корзину” VirtueMart не работает на главной странице сайта

Автор max_max

Ответов: 0
Просмотров: 6437
Последний ответ 20.04.2021, 12:40:37
от max_max
Фильтрация по строкам и стили таблицы - некорректная работа

Автор vegastk

Ответов: 15
Просмотров: 1126
Последний ответ 26.08.2019, 15:10:36
от vegastk
Отключить скрипты для одной страницы

Автор mixis

Ответов: 5
Просмотров: 8239
Последний ответ 08.03.2019, 10:06:54
от Сергей Гончаров
Ошибка в слове на главной странице. Как исправить?

Автор nqui

Ответов: 3
Просмотров: 2826
Последний ответ 29.03.2018, 05:15:41
от TkGhoul
Тайтл Главной страницы сайта

Автор gromlan

Ответов: 6
Просмотров: 1848
Последний ответ 28.02.2018, 16:57:15
от gromlan