onscroll Event Not Firing in ASP.NET 2.0

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

While attempting to get my floating toolbar to work in ASP.NET 2.0, I
noticed that the onscroll event is not firing. I've specified this on
the BODY tag, as always.

After some testing, I realized that the new DocType being used in 2.0
(<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">) is the
culprit.

Upon using the old 1.1 DocType (<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.0 Transitional//EN" >) the onscroll event began firing again.

I've read that the new doctype really should be used, but I can't seem
to find any workarounds when using the new one.

Anyone else having this problem?
 
The DOCTYPE is for XML (XHTML is a type of XML) and has absolutely
nothing to do with ASP.NET in any way shape or form. If you use it,
you have stronger rules to apply. Make sure you run your output
through an XHTML validator. As programmers we must obey the specs,
even if things seem to work perfectly. So, it's not that one is 1.1
and the other is 2.0.

You're going to have to paste some code. What do you mean it's on
<body> "as always"? That means we have to compare that to something...
what are we comparing it to? Like I say XHTML has more rules to help
keep us in line (the point of rules!) So, while HTML didn't care about
anything and was an environment for complete and utter anarchy, XHTML
grants us a level of control and elegance. You're breaking a rule
somewhere...
 
It appears that when I use the XHTML doctype, the BODY tag does not expose
an onscroll event. When using the other doctype I mentioned, the onscroll
event is valid on the BODY tag and fires when appropriate.
 
Back
Top