...

View Full Version : doc type and script



mikacruz
06-12-2010, 03:53 PM
Hi there,
I am having a hard time trying to understand this:

The script I am using does not work if I write doctype as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
But it does when removing the link:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >

However when I remove the link from the doc type, in IE my selected menu is unaligned;

Here is the link. (http://www.eulconsult.eu/testcenter.html)

Have you got an idea about why it does not work with the full doc type?
Thanks a lot for having a look;

abduraooft
06-12-2010, 04:07 PM
var userInputs = myform.elements; The culprit is the above line. The attribute name on form is deprecated and so the old practice to refer a form like above won't work with a standard DOCTYPE.

I'd recommend the following strict DOCTYPE.

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

var userInputs = document.forms.myform.elements;

<form id="myform">



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum