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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.