Forum Moderators: open

Message Too Old, No Replies

document.write for application/xhtml+xml?

If the google search only worked :-\

         

JAB Creations

1:17 am on Dec 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How can I document.write while serving application/xhtml+xml? I know you can't...what I mean is how do I go about say, putting an <h2> element via JavaScript now?

I've come across this but it is not working...

<script type="text/javascript">
if (document.getElementById) {
var h2=document.createElementNS("http://www.w3.org/1999/xhtml","h2");
document.getElementsByTagName("message")[0].appendChild(h2);
}
</script>

John

JAB Creations

4:45 am on Dec 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Came across something that was actually what I was looking for (save the actual file location and mime).

<script type="text/javascript">
if (document.getElementById) {
var l=document.createElementNS("http://www.w3.org/1999/xhtml","link");
l.setAttribute("rel", "stylesheet");
l.setAttribute("type", "text/css");
l.setAttribute("href", "../themes/theme-city.css");
l.setAttribute("media", "screen");
document.getElementsByTagName("head")[0].appendChild(l);
}
</script>