ic*******@hotpop.com wrote:
I have been trying to open a new window in Word/OO Writer with JS
using the following code (and numerous variations I could add...):
tw = window.open('about:blank','');
tw.document.writeln('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">');
tw.document.writeln('<HTML><HEAD>');
tw.document.writeln('Content-type: application/msword');
tw.document.writeln('</HEAD>');
tw.document.writeln('<BODY><FORM method="POST">');
tw.document.writeln('Hello earth');
tw.document.writeln('</FORM></BODY></HTML>');
I would presume that is atrocious by any standard of any sentient species.
Consider this instead:
var tw = window.open('', 'popup');
if (tw)
{
var d;
if ((d = tw.document) && d.open && d.write && d.close)
{
d.open("text/html");
d.write(
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"'
+ ' "http://www.w3.org/TR/html4/loose.dtd">'
+ '<HTML>'
+ '<BODY><FORM action="" method="POST">'
+ 'Hello Earth'
+ '<\/FORM><\/BODY><\/HTML>');
d.close();
}
}
The new window opens OK, but in the browser. What am I missing? [...]
Isn't it obvious to you that a word processor is not a browser, that HTML is
not HTTP, and that neither HTML or OO Writer are MS Word? And your
generated markup is far from being Valid.
In short: You don't have a single clue what you are doing.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann