我怎样才能改变DOCTYPE [英] how can i change the DOCTYPE
本文介绍了我怎样才能改变DOCTYPE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经尝试过使用这个函数,
document.doctype('<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 3.2 Final // EN>'); ,
但它不起作用。
解决方案
我希望这个人可以帮助你们中的一些人(在控制台进行测试,它改变了实际的DOCTYPE)
var newDoctype = document.implementation.createDocumentType($ b $ html',
' - // W3C // DTD XHTML 1.0 Transitional // EN',
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdd'
);
document.doctype.parentNode.replaceChild(newDoctype,document.doctype);
anyone here know how i can dynamically change the doctype with javascript?
i have tried with this function,
document.doctype('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'); ,
but it does not work.
解决方案
I hope this one might help some of you ( Tested in Console and it changes actual DOCTYPE)
var newDoctype = document.implementation.createDocumentType(
'html',
'-//W3C//DTD XHTML 1.0 Transitional//EN',
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdd'
);
document.doctype.parentNode.replaceChild(newDoctype,document.doctype);
这篇关于我怎样才能改变DOCTYPE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文