View Full Version : Javascript and <!DOCTYPE

07-22-2009, 12:06 AM
I have a problem with customer website. My script creates an Auto-Greet that overlays the page, displays in the lower left of the browser and remains visible as the user scrolls the page.

My Mockup the customer home page. This is the desired action.

Customer website: (undesired action)

The only difference is that my customers does not declare a .dtd document.
They have a <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">.

On my mock-up, I declare a .dtd document and my script works.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Question: I'm trying to figure out a way in javacript to dynamically change the <!DOCTYPE, is this possible?

07-22-2009, 02:40 AM
While the doctype is available to javascript from the header, it is read only. your last chance to change this is on the server side before any headers are sent.