Home >Web Front-end >JS Tutorial >Under XHTML, the problem of invalid JS floating code_javascript skills
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.