/    Sign up×
Community /Pin to ProfileBookmark

How could I put a button on a form that would print the page without using the print command of the browser?

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayNov 07.2005 — <button onclick="window.print()">Print</button>
Copy linkTweet thisAlerts:
@BobotheBugbearNov 08.2005 — Never heard of a "button" tag :p

Anyway, here are some examples.

<input type="button" onclick="javascript:window.print()">

<a href="javascript:window.print()">your text here</a>

<a href="javascript:window.print()"><img src="yourimage.gif"></a>

Sometimes, it is better to put javascript:window.print than just window.print though it seems to also be user preference. I've seen them both work.

Have fun. ?
Copy linkTweet thisAlerts:
@TheBearMayNov 08.2005 — Never heard of a "button" tag :p

...[/QUOTE]


http://www.w3.org/TR/html401/interact/forms.html#h-17.5 ?
Copy linkTweet thisAlerts:
@LeruraNov 08.2005 — Never heard of a "button" tag :p
[/QUOTE]

Then you have just missed something.

The <button></button> tag is an advanced form of <input type="button">

and can do whatever a input-button can do.

You can read more about this tag [URL=http://www.blooberry.com/indexdot/html/tagpages/b/button.htm]here[/URL]
×

Success!

Help @steph14 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...