Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-10-14
16
Medium Priority
?
598 Views
Last Modified: 2013-11-19
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...
0
Comment
Question by:Kamoku-Wan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 4
16 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12314432
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
 
LVL 3

Author Comment

by:Kamoku-Wan
ID: 12314472
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
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 12314542
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
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 
LVL 3

Author Comment

by:Kamoku-Wan
ID: 12314677
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
 
LVL 3

Author Comment

by:Kamoku-Wan
ID: 12315169
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
 
LVL 3

Expert Comment

by:hemebond
ID: 12316211
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12318845
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
 
LVL 3

Author Comment

by:Kamoku-Wan
ID: 12321269
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12321614
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
 
LVL 3

Expert Comment

by:hemebond
ID: 12324107
"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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12324287
text/html

Cd&
0
 
LVL 3

Expert Comment

by:hemebond
ID: 12324804
Then what's the point of using XHTML markup?
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12324855
>>> 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
 
LVL 3

Expert Comment

by:hemebond
ID: 12325236
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
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12327803
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
 
LVL 3

Expert Comment

by:hemebond
ID: 12334351
"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

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to count occurrences of each item in an array.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question