!DOCTYPE screws up page layout

G

Gerard Seibert

I am having a problem that I can just not figure out. If I run the following, it will produce a jumble of text at the top of the screen. However, if I remove the !DOCTYPE declaration, it will work perfectly.

This is the HTML code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test of Positioning</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="copyright" content="Copyright © 2003, Bud Man">
<meta name="description" content="Your DESCRIPTION TEXT here">
<meta name="keywords" content="Your KEYWORDS TEXT here">
<meta name="rating" content="General">
<meta name="robots" content="Index, follow">
<style type="text/css">
P {behavior:url(pos.htc);
border:1px black solid;
font:10pt geneva, arial;
padding:2pt}
</style>
</head>
<body>
<p vpos="top" hpos="left"><nobr>Top-Left</nobr></p>
<p vpos="top" hpos="center"><nobr>Top-Center</nobr></p>
<p vpos="top" hpos="right"><nobr>Top-Right</nobr></p>
<p vpos="middle" hpos="left"><nobr>Middle-Left</nobr></p>
<p vpos="middle" hpos="center"><nobr>Middle-Center</nobr></p>
<p vpos="middle" hpos="right"><nobr>Middle-Right</nobr></p>
<p vpos="bottom" hpos="left"><nobr>Bottom-Left</nobr></p>
<p vpos="bottom" hpos="center"><nobr>Bottom-Center</nobr></p>
<p vpos="bottom" hpos="right"><nobr>Bottom-Right</nobr></p>
</body>
</html>

This is the code for pos.htc:

<PUBLIC:COMPONENT NAME="ID_POSITION">
<PUBLIC:pROPERTY NAME="vpos">
<PUBLIC:pROPERTY NAME="hpos">
<SCRIPT>
// Copyright 1999 InsideDHTML.com, LLC. All rights reserved.
// For more information, see www.insideDHTML.com
// This behavior can be reproduced as long as this copyright
// notice is not removed.

var hExpr = "",vExpr = ""

switch (vpos) {
case "top":
vExpr="document.body.scrollTop+offsetHeight-offsetHeight"
break;
case "middle":
vExpr="document.body.scrollTop+((document.body.clientHeight-offsetHeight)/2)"
break;
default:
vExpr="document.body.scrollTop+document.body.clientHeight-offsetHeight"
}

switch (hpos) {
case "left":
hExpr="document.body.scrollLeft+offsetLeft-offsetLeft"
break;
case "center":
hExpr="document.body.scrollLeft+((document.body.clientWidth-offsetWidth)/2)"
break;
default:
hExpr="document.body.scrollLeft+document.body.clientWidth-offsetWidth"
}

style.position = "absolute"
style.setExpression("top",vExpr)
style.setExpression("left",hExpr)
</SCRIPT>
</PUBLIC:COMPONENT>

I would appreciate any help that someone could give me.

Thanks!

Gerard E. Seibert
(e-mail address removed)

I am just an old country boy in a big town trying to get along. I have been eating pretty regular and the reason I have been is because I have stayed an old country boy.

- Will Rogers
 
J

Jimmy

I am having a problem that I can just not figure out. If I run the following, it will produce a jumble of text at the top of the screen. However, if I remove the !DOCTYPE declaration, it will work perfectly.

This is the HTML code:

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


A quick check in a validator tells me that your code does not meet the
DOCTYPE requirements you included. It also appears to be MS
proprietary. There are errors in your script code.
 
C

Cheryl D. Wise

<nobr> is not valid code under a strict doctype definition. Generally with
FrontPage it is better to use a transitional or loose doctype.

In addition the validator has no way of knowing what "vpos" or "hpos" is so
it will never validate in any W3C validator.

--
Cheryl D. Wise
MS-MVP-FrontPage
http://wiserways.com

I am having a problem that I can just not figure out. If I run the
following, it will produce a jumble of text at the top of the screen.
However, if I remove the !DOCTYPE declaration, it will work perfectly.

This is the HTML code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test of Positioning</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="copyright" content="Copyright © 2003, Bud Man">
<meta name="description" content="Your DESCRIPTION TEXT here">
<meta name="keywords" content="Your KEYWORDS TEXT here">
<meta name="rating" content="General">
<meta name="robots" content="Index, follow">
<style type="text/css">
P {behavior:url(pos.htc);
border:1px black solid;
font:10pt geneva, arial;
padding:2pt}
</style>
</head>
<body>
<p vpos="top" hpos="left"><nobr>Top-Left</nobr></p>
<p vpos="top" hpos="center"><nobr>Top-Center</nobr></p>
<p vpos="top" hpos="right"><nobr>Top-Right</nobr></p>
<p vpos="middle" hpos="left"><nobr>Middle-Left</nobr></p>
<p vpos="middle" hpos="center"><nobr>Middle-Center</nobr></p>
<p vpos="middle" hpos="right"><nobr>Middle-Right</nobr></p>
<p vpos="bottom" hpos="left"><nobr>Bottom-Left</nobr></p>
<p vpos="bottom" hpos="center"><nobr>Bottom-Center</nobr></p>
<p vpos="bottom" hpos="right"><nobr>Bottom-Right</nobr></p>
</body>
</html>

This is the code for pos.htc:

<PUBLIC:COMPONENT NAME="ID_POSITION">
<PUBLIC:pROPERTY NAME="vpos">
<PUBLIC:pROPERTY NAME="hpos">
<SCRIPT>
// Copyright 1999 InsideDHTML.com, LLC. All rights reserved.
// For more information, see www.insideDHTML.com
// This behavior can be reproduced as long as this copyright
// notice is not removed.

var hExpr = "",vExpr = ""

switch (vpos) {
case "top":
vExpr="document.body.scrollTop+offsetHeight-offsetHeight"
break;
case "middle":

vExpr="document.body.scrollTop+((document.body.clientHeight-offsetHeight)/2)
"
break;
default:
vExpr="document.body.scrollTop+document.body.clientHeight-offsetHeight"
}

switch (hpos) {
case "left":
hExpr="document.body.scrollLeft+offsetLeft-offsetLeft"
break;
case "center":

hExpr="document.body.scrollLeft+((document.body.clientWidth-offsetWidth)/2)"
break;
default:
hExpr="document.body.scrollLeft+document.body.clientWidth-offsetWidth"
}

style.position = "absolute"
style.setExpression("top",vExpr)
style.setExpression("left",hExpr)
</SCRIPT>
</PUBLIC:COMPONENT>

I would appreciate any help that someone could give me.

Thanks!

Gerard E. Seibert
(e-mail address removed)

I am just an old country boy in a big town trying to get along. I have been
eating pretty regular and the reason I have been is because I have stayed an
old country boy.

- Will Rogers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top