SitePoint Sponsor

User Tag List

Results 1 to 17 of 17
  1. #1
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Insert doctype with a javascript

    I am using Miva Merchant as a shopping cart and was wondering if it would be possible to insert a doctype onto my pages with a javascript so that I could at least get some stable design results from my XHTML/CSS.

    Of course, the doctype would have to be inserted before the opening <html> tag, but I don't think that should be difficult. All I need is a simple script that I can embed or link to on my miva pages that will write the doctype on the page (perhaps using an onload event handler?) since the Miva control modules don't allow for a doctype declaration. I also realize that if someone has disabled javascript on their browser, my page will probably fall apart, unless I use php or perl. Any suggestions would be most welcome.

    Can one of you javascript gurus point me in the right direction?
    Last edited by garlinto; Jul 4, 2003 at 16:10.
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not possible.

    I'll kiss the feet of the person that proves me wrong.

    Sorry.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by w3.org
    [Interface Document Attributes]
    doctype of type DocumentType, readonly, modified in DOM Level 3
    The Document Type Declaration (see DocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returns null.
    This provides direct access to the DocumentType node, child node of this Document. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as insertBefore, or replaceChild. Note, however, that while some implementations may instantiate different types of Document objects supporting additional features than the "Core", such as "HTML" [DOM Level 2 HTML], based on the DocumentType specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.

  4. #4
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by beetle
    Not possible.

    I'll kiss the feet of the person that proves me wrong.
    I would sooooo love for somebody to be right.
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  5. #5
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, is that saying "only with DOM3 support can you change it, but it won't make a difference anyway"

    Who supports DOM3, specifically?

    ??
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  6. #6
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "...very unlikely to result in a change of the features supported."
    I guess there's no idea to try

  7. #7
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jofa
    "...very unlikely to result in a change of the features supported."
    I guess there's no idea to try
    Well, it seems reasonable to me that if you write the doctype on the page after the page is loaded and rendered by the browser, then yes, no affect would be noticed.

    But if you could write the doctype onto the page before the rest of the html is sent, I would think that it would act like a normal html/xhtml document that had an embedded doctype.

    So, I guess my ramblings are leading to this: Is there a way to write the doctype to the page using javascript, such that the doctype is written first by the script before the rest of the page loads, or could you force the page to reload once it hits the script which will then cause the page to be written with a doctype, or am I just talking crazy?
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  8. #8
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    More or less crazy
    If you want to write something onto the page/document (not the body of the document), use php, not js

  9. #9
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is, of course, one possible solution including javascript: If you open a new browser window from doc1, then you can use js to write stuff onto doc2

  10. #10
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:


    I write "java&#115;cript:" (no space), but the result is "javascript:"


  11. #11
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Well, I guess I'll just have to be the first to write a Miva Module that will allow for standards-compliant design control.

    I did a number of googles looking for someone who had written a miva module of just this type, but to no avail: they all use tables to layout their designs, and with no doctype whatsoever at that.

    Maybe I've found a miva module market niche!

    Thanks for all of the responses.
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  12. #12
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://validator.w3.org/check?uri=www.miva.com
    Fatal Error: No DOCTYPE specified!

  13. #13
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jofa
    http://validator.w3.org/check?uri=www.miva.com
    Fatal Error: No DOCTYPE specified!
    Thats exactly what I'm sayin'.
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  14. #14
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kind of "Not so good way of marketing your 'dynamic browser based storefront development and management' products"

  15. #15
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DOM3 Who supports it ? At the moment it is still to be implemented although you can bet that Mozilla will be the first out the door with support...

  16. #16
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    DOM3 Who supports it ? At the moment it is still to be implemented although you can bet that Mozilla will be the first out the door with support...
    Mozilla has supported DOM3 XPath for quite some time. And you can find code for the DOM3 Load and Save module in the Mozilla branch, though it doesn't seem exposed to scripting yet.

  17. #17
    SitePoint Member
    Join Date
    Sep 2004
    Location
    Dallas
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


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
  •