|
 |
>> Well, that's very nice, but as far as I can see, there's no equivalent
>> way of doing what document.write does.
>
> what? like:
> var foo=document.getElementById("foo");
> var p=document.createElement("p");
> var txt=document.createTextNode("Text in the paragraph!");
> p.appendChild( txt );
> foo.appendChild( p );
>
> or something like that (it's been a while I last fiddled with DOM)...
>
> not as practical as document.write, of course...
In particular, it works *only* if you tag the place where you want the
generated content to go, or you know enough about the static structure
of the document to be able to navigate to it.
My usual trick is to do document.write("JavaScript is enabled."). It's a
nice, simple way of determining whether the browser supports JS and has
it enabled. It's also useful for not showing buttons for features that
require JS if JS is not available...
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
 |