/    Sign up×
Community /Pin to ProfileBookmark

Open a doc automatically on load

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.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JAug 14.2003 — 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");
Copy linkTweet thisAlerts:
@Dr__PossibleauthorAug 14.2003 — 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.
×

Success!

Help @Dr__Possible spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...