Click to See Complete Forum and Search --> : Open a doc automatically on load


Dr. Possible
08-14-2003, 10:08 AM
Greetings,

I have a notepad .html file called Test.html When I click a button, it makes a popup window and automatically prints the text inside it.

My question is now: Instead of it saying "Example Text", how can I make it load up "C:\test.doc" into the popup window via Mircosoft Word's IE plug-in?

I can already get "C:\test.doc" to open into IE when I click on a hyperlink, but I just don't know how to do it in a popup window.

This is the entire code:
-------------------------------------------------------------------
<html>
<script language="JavaScript">
var msg;
function WinOpen() {
msg = open("","PopupWindow","toolbar=no,directories=no,menubar=no");
msg.document.open()
msg.document.write("Example Text");
msg.document.close()
msg.print()
}
</script>
<body>
<input type="button" value="Print" name="B3" style="font-family: Arial Rounded MT Bold; color: #000044" onClick="WinOpen()">
</body>
</html>
-------------------------------------------------------------------

Any help would be greatly appreciated!!!
Thanks in advance,
Matthew.

Mr J
08-14-2003, 01:47 PM
Try changing this line

msg = open("","PopupWindow","toolbar=no,directories=no,menubar=no");

to

msg = open("C:\test.doc
","PopupWindow","toolbar=no,directories=no,menubar=no");

Dr. Possible
08-14-2003, 02:01 PM
Thank you Mr J!!
My html page works perfectly now!

I had to change a few things however. It wouldnt work unless test.doc was in the same directory as the html page.

Because of this, I just changed the filepath string in the code you gave me and I was good to go.

This is the entire html code I have (and it works):
-------------------------------------------------------------------
<html>
<script language="JavaScript">
var msg;
function WinOpen() {
msg = open("test.doc","PopupWindow","toolbar=no,directories=no,menubar=no");
msg.document.open()
//msg.document.write("Example Text");
msg.document.close()
msg.print()
}
</script>
<body>
<input type="button" value="Print Now!" name="B3" style="font-family: Arial Rounded MT Bold; color: #000044" onClick="WinOpen()">
</body>
</html>
-------------------------------------------------------------------

Thank you!
Matthew.