RE: Scripting Techniques first draft

Regarding document.write():

<Yvette wrote>
Personally, I have found document.write a very useful technique in 
creating
accessible websites that transform gracefully. If I create additional
features in a website that require Javascript, I always make sure to
document.write them. For example: if I create a hyperlink that increases 
the
fontsize or swaps the stylesheet, I always document.write that link so it
will only appear if Javascript is enabled. This ensures that people who do
not have Javascript are not confronted with a confusing link that doesn't
work. 
</Yvette>

<Becky's response>
We need to be careful about document.write() as it is not supported in 
XHTML.  See http://www.w3.org/MarkUp/2004/xhtml-faq.   Item #14 states:
Does document.write work in XHTML?
No. Because of the way XML is defined, it is not possible to do tricks 
like this, where markup is generated by scripting while the parser is 
still parsing the markup.
You can still achieve the same effects, but you have to do it by using the 
DOM to add and delete elements.
</becky>

-becky





Becky Gibson
Web Accessibility Architect
                                                       
IBM Emerging Internet Technologies
5 Technology Park Drive
Westford, MA 01886
Voice: 978 399-6101; t/l 333-6101
Email: gibsonb@us.ibm.com

Received on Tuesday, 14 September 2004 18:32:29 UTC