Document Type Declaration causing onScroll event to not fire...

When I use the following document declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

It will prevent the onScroll event in the <BODY> tag from firing.  However, when I remove this declaration it prevents me from using some of the more advanced CSS styles that our site requires.  Anyone know of a way to get the best of both worlds.



Side Note:  Thus far, I have to replace both those lines with just a <html> tag I can't replace one or the other...
LVL 3
Kamoku-WanAsked:
Who is Participating?
 
COBOLdinosaurCommented:
Hmmm...

According to:

http://www.blooberry.com/indexdot/html/tagpages/attributes/events.htm

Onscroll is not supported. within the standards.  However xhtml is the first DTD I have seen to enforce it.  

Cd&
0
 
COBOLdinosaurCommented:
if you are actually using that spelling "onScroll " it will fail becasue events must be all lower case in xhtml.

If you are already using lower case then put the onscroll at the end of the script:

onscroll=yourfunction;
</script>

Cd&
0
 
Kamoku-WanAuthor Commented:
Yes I am using onscroll sorry I typed that up quick and didn't cut and paste.

I tried your idea of putting onscroll=yourfunction; at the end of my script with no luck.

It's as if that DTD blocks onscroll for some reason?
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
Kamoku-WanAuthor Commented:
Ahh good catch.  Now can you perhaps offer me another DTD that might work for me?  The only CSS item I find that seems to mess up when I don't use this one is line-height.  It seems my designers can't live without their line-height... :-)
0
 
Kamoku-WanAuthor Commented:
I think I found the issue with the line-height not being used.  The line height was being set to a class object.  Then that class object was being called on a TD tag with a nested table inside it.  I moved the class object to be part of the TABLE tag and viola it started working.  onscroll still doesn't work with XHTML, but now it appears I don't have to use it.  Man I wish I could though...
0
 
hemebondCommented:
Why on Earth are you using XHTML? Transitional gives you no benefit over HTML. And you say you have nested tables? So you're not even using clean semantic code? You should learn how to use HTML correctly and cleanly before trying to use a stricter markup.
0
 
COBOLdinosaurCommented:
The doctype I use is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 

That keeps everything to the tightest standards short to XHTML. It is where I have found the least incompatibilities between IE and Mozilla, and I have never run into an issue with events. I don't use the XHTML doctype except experimentally, because the standard is still not mature, and I think there wil have to be some revisions before we see wide adoption.

Cd&
0
 
Kamoku-WanAuthor Commented:
Cobol,

Thanks for your help mate.  We aren't ready to migrate to Strict yet that is why we are using Transitional.  We are in the process.  I will have to do some testing with Strict to see if it blocks the onscroll event.

hemebond,

You are pretty cocky for not knowing the scope of the project.  Unfortunely, I don't have the time to discuss your knee-jerk reaction with you.  So I am going to award Cobol the points for attempting to help find a solution.
0
 
COBOLdinosaurCommented:
Thanks for the A.

In defence of hemebond; they are right about the use of nested tables for layout management. That will create a lot of problems trying to maintain pages.  The modern approach is to seperate content from presentation using CSS to manage layout.  It is not always a quick and easy transition, but if you are migrating to a more flexible, standards-compliant presentation you will find the tables get in your way and each fix makes it more difficult to do the next one.

Cd&
0
 
hemebondCommented:
"You are pretty cocky for not knowing the scope of the project." If you plan on supporting Internet Explorer at all, use HTML. Simple.

COBOLdinosaur do you serve your pages as application/xhtml+xml ?
0
 
COBOLdinosaurCommented:
text/html

Cd&
0
 
hemebondCommented:
Then what's the point of using XHTML markup?
0
 
COBOLdinosaurCommented:
>>> Then what's the point of using XHTML markup?

Gee, maybe its because it costs nothing and at some point xhtml becomes the best choice.

I make a living by deliverying solutions that work the day I deliver them and every day after; and there is no profit in going back to fix mistakes you made because you were not capable of seeing three inches past today.

Cd&
0
 
hemebondCommented:
Oh well, with that attitude you must know better than me. And the W3c. And respected members of the web-developer community. I mean, you must have read http://www.hixie.ch/advocacy/xhtml and http://www.w3.org/MarkUp/2004/xhtml-faq.

And maybe you know some trick, that I don't, about stopping standards-compliant browsers from converting <br/> into <br>/. Or some way to make browsers render your code, without having to use error-correction to make <script/> into <script></script>.

I mean, you MUST know all about using global find+replace methods for updating clean, semantic markup.

Please, COBOLdinosaur, enlighten us.
0
 
COBOLdinosaurCommented:
Why don't you post a list of mainstream browsers you THINK are standards compliant.  Then you can post the list of W3C standards that have actually been fully implemented by any major manufacturer. A developers job is to deliver product.  If you don't like a pragmatic approach to the use of the available tools, I suggest you start to work building the perfect toolset that will insure everything can be done to the standards that you think should be applied.

While you are at it you can add some information to your profile so we know if you are a 13-year old or just an academic whose only purpose in life is to lament the emphasis on getting thing to work instead of producing perfect abstractions.

If you want a debate then take it to the lounge or experts input, because if I post again in this thread it will be with an admin comment.

Cd&
0
 
hemebondCommented:
"While you are at it you can add some information to your profile so we know if you are a 13-year old or just an academic whose only purpose in life is to lament the emphasis on getting thing to work instead of producing perfect abstractions." Done. And currently I'm working in the construction industry where I use a web-based system to track Quality Assurance for my department.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.