SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Midwest
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Change DOCTYPE - SystemId

    For more advance, web 2.0 techniques to be accomplished, pages need to have the DOCTYPE set to something such as

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

    I looked on Google and it looks like DOCTYPE is read only. But I wanted to check with other people to see if there is a work around for this.

    I want to write a JavaScript function to check the DOCTYPE systemId and if it was not set to http://www.w3.org/TR/html4/loose.dtd, it would then added it to the DOCTYPE.

    Is this possible?

    I noticed I can display the systemId like this.

    var sysId = document.doctype.systemId;
    alert( "systemId = " + sysId );

    Any help with this is appreciated.

    Thanks.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,701
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    It's readonly, so you can't change it from the javascript function.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,810
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Changing the doctype makes no sense, you'd need to rewrite all the HTML as well to match the new language specification.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Guru
    Join Date
    Nov 2005
    Location
    Midwest
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the feedback.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •