Home  >  Article  >  Web Front-end  >  Under XHTML, the problem of invalid JS floating code_javascript skills

Under XHTML, the problem of invalid JS floating code_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:41:531279browse

Couplet code, check its expression under xhtml, the result is very simple. This is because, according to standards, the scroll bars of the form we see should not be of the body, but of the HTML (that is, the document.documentElement object). Therefore, the solution is: put the non-standard code in the html " document.body.scrollTop" is transformed into "document.documentElement.scrollTop", everything is ok!

(Invalid scope: XHTML 1.0 transitional.dtd; XHTML 1.0 strict.dtd; It is generally sufficient to replace the body with document.documentElement, but if it is to be compatible with non-xhtml situations, generally one judgment is
scrollTop=document.body.scrollTop?document.body.scrollTop:document.documentElement and other judgments


http://www.jb51.net/article/19931.htm

http://www.jb51.net/article/2447.htm
In fact, everyone can Read more articles previously published by Script House.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn