Jump to content

[SOLVED] Witch DOCTYPE?


tinker

Recommended Posts

Hi,

Let's suppose i've got this simple example:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>Layer test</title>

<style type='text/css'>
#test_layer
{
position: absolute;
top: 100px;
left: 200px;
visibility: visible;
background-color: #efefef;
}
</style>

<script type="text/javascript">
function layer_get(id)
{
return document.getElementById(id).style;
}
function layer_moveto(x, y, id)
{
var l = layer_get(id);
l.left = x;
l.top = y;
}
</script>

</head><body>

<div id="test_layer">
This is our test layer
</div>

<h2>Layers</h2>
<a href="#" onclick="layer_moveto(50, 50, 'test_layer')">Move</a><br>
<br><br>
</body></html>

 

However because it lacks a full doctype definition it will fall back to quirksmode. However if I use:

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

it passes muster with the validator but the script throws error's saying that 'top' and 'left' have been dropped because of a parse error.

 

So, my questions are, does it really matter that I use the first doctype shown here, how bad is it to fall back to quirksmode (since it's transitional anyway (and I think it falls back to some form of quirksmode anyway)), and is there a way to use a full doctype and the script to work?

 

 

W3C VALIDATOR

Link to comment
https://forums.phpfreaks.com/topic/87935-solved-witch-doctype/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.