...

View Full Version : Gap issue when doctype changes



Sman5109
07-18-2007, 03:31 AM
Hello, I have a page that i didnt code but am recoding it to be xhtml 1.1 valid. I have gotten it so the page is valid xhtml 1.1 without any errors but i just noticed that when i change the doctype to anything above 1.0 trans, a gap appears in the dropdown menu. I have no idea whats wrong or how to fix it. The pages below are the same page but with different doc types.

1.0 trans page with no issues - REMOVED

1.0 strict page with gap issue - REMOVED
Thank You!

Note: This looks fine in IE7, so try not to use it.

_Aerospace_Eng_
07-18-2007, 05:28 AM
If you don't know how to pass the application/xhtml+xml header then don't use an XHTML 1.1 doctype.

For information about the gaps read this
http://developer.mozilla.org/en/docs/Images,_Tables,_and_Mysterious_Gaps
It doesn't only apply to tables.

Sman5109
07-18-2007, 05:49 AM
Ok, i added a css something and that fixed the gap. And i know how to use the header. That leads me to my next problem. The page below has the xhtml 1.1 doctype and is served as application/xhtml+xml. But now when it is served as that the drop menu stops working all together. Whats wrong now?

REMOVED

koyama
07-18-2007, 06:14 AM
The page below has the xhtml 1.1 doctype and is served as application/xhtml+xml. But now when it is served as that the drop menu stops working all together. Whats wrong now?

http://toogr.net/elivalidtest85974596/indexrender.php
I don't think that you can use document.write in XHTML. Your JavaScript contains such statements.

Anyway, what is the point using XHTML? Are you doing this as an exercise?

Sman5109
07-18-2007, 06:41 AM
Ok, i know nothing about JS, what do i replace the document.write with? The only instance of it is Here (http://toogr.net/elivalidtest85974596/scripts.js) on line 60.


Anyway, what is the point using XHTML? Are you doing this as an exercise?Its called Future Proofing (http://en.wikipedia.org/wiki/Future_proofing). :)

_Aerospace_Eng_
07-18-2007, 07:00 AM
I suggest you use a different menu. Try creating one from scratch. Its not that hard. Your menu relies on javascript to even work meaning users with JS disabled see no menu including search engines. If you are so worried about future proofing then I suggest you redo your menu using normal unordered lists so it doesn't rely on JS to be enabled. Who knows in the future JS could no longer exist (not likely) but you never know.

http://www.alistapart.com/articles/dropdowns/

Sman5109
07-18-2007, 07:05 AM
Yeah, thats what i thought. That damn coder just did it because it was the easiest and fastest way of getting it done. Stupid coder :(

BTW, if im going to create a new menu i want to do one that is completely CSS. Do you have a good tut for one?

_Aerospace_Eng_
07-18-2007, 07:24 AM
Why don't you try clicking the link in my post?

Sman5109
07-18-2007, 07:29 AM
I did, but at the end it wants you to add some JS:


startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;

_Aerospace_Eng_
07-18-2007, 07:48 AM
That JS is for IE6. IE6 doesn't support :hover on non-link elements. Personally I would use the menu in the link I provided however if you still prefer not to use JS then its going to be a little more work and probably give you a headache.

http://cssplay.co.uk has some full CSS menus that don't use javascript but it uses a ton of IE conditional comments to feed it invalid html. Koyoma will likely say something like "I don't mind feeding invalid html to a non standards browser."

Sman5109
07-18-2007, 07:49 AM
Ok , thank you for your help. :)

felgall
07-18-2007, 07:58 AM
Since even IE 8 is not going to support XHTML there is no reason for including that JavaScript for the menu if you always serve the page as XHTML since the only browser that needs the JavaScript will be unable to process any of the page content to start with. It is only if you are going to change the header to serve the page as HTML to IE that you will need that JavaScript.

The other problem with that JavaScript is that it doesn't restrict itself to IE6 as it ought to but will also run unnecessarily in IE7 and all recent versions of Opera. If you are going to use it then get rid of the

if (document.all&&document.getElementById) {

test and place the entire JavaScript in conditional comments testing for IE6.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum