Click to See Complete Forum and Search --> : Javascript with .doc ?


thenetfreaker
12-21-2003, 01:11 AM
Will javascript open a blablabla.doc file[in a new window for example]?

fredmv
12-21-2003, 01:13 AM
Try this:<script type="text/javascript">
//<![CDATA[
window.open('foo.doc', '', '');
//]]>
</script>

thenetfreaker
12-21-2003, 01:31 AM
thanks, the works perfectlly, and i have another question :
can i make javascript WRITE into a doc file ?[if yes so how]

fredmv
12-21-2003, 01:35 AM
You're welcome. I don't believe what you're trying to do is possible with JavaScript. It may be possible with some kind of ActiveX object, however, I'm not sure which one you'd be looking for since I've never had to make something like this.

thenetfreaker
12-21-2003, 01:38 AM
or, at least, is it possible to open a few .doc files in one web-page ? [if it's possible, so tell me the code please]

fredmv
12-21-2003, 01:44 AM
All you should need to do is make a simple link to the .doc file:<a href="foo.doc">bar</a>Note that this works for other special file types too (e.g., PDF), it depends on whether the browser has the plug-in installed or not.

thenetfreaker
12-21-2003, 01:50 AM
no, if i want to open foo1.doc and foo2.doc at once in the same popup window, how do i do it ? PLEASE

fredmv
12-21-2003, 02:21 AM
<script type="text/javascript">
//<![CDATA[
function launchFiles(file1, file2)
{
var html = '<html><head><title>displaying ' + file1 + ' &amp;amp; ' + file2 + '</title></head><frameset cols="50%, *"><frame src="' + file1 + '" /><frame src="' + file2 + '" /></frameset></html>';
var w = window.open('', '', 'height=500,width=750');

with(w.window.document)
{
write(html);
close();
}
}
//]]>
</script><a href="#" onclick="launchFiles('foo.doc', 'bar.doc');">Launch two files.</a>

thenetfreaker
12-21-2003, 02:27 AM
thanks a lot

fredmv
12-21-2003, 02:35 AM
You're quite welcome. ;)