/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Print page button

Hi all!

I have the coding for the print button but I would like to add in my own graphic button. Right now, it is just a default button. Where do I add the graphic button within this JavaScript?

[CODE]<SCRIPT Language=”Javascript”>
function printit(){
if (window.print) {
window.print() ;
} else {
var WebBrowser = ‘<OBJECT ID=”WebBrowser1″ WIDTH=0 HEIGHT=0 CLASSID=”CLSID:8856F961-340A-11D0-A96B-00C04FD705A2″></OBJECT>’;
document.body.insertAdjacentHTML(‘beforeEnd’, WebBrowser);
WebBrowser1.ExecWB(6, 2);
}
}
</script>
<SCRIPT Language=”Javascript”>
var NS = (navigator.appName == “Netscape”);
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
document.write(‘<form><input type=button value=”Print this Page” name=”Print” onClick=”printit()”></form>’);
}
</script>[/CODE]

Thanks in advance!!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayJun 05.2008 — You'll have to replace the line that reads:
<i>
</i> document.write('&lt;form&gt;&lt;input type=button value="Print this Page" name="Print" onClick="printit()"&gt;&lt;/form&gt;');
Copy linkTweet thisAlerts:
@CreativeMindauthorJun 05.2008 — TheBearMay, thanks for your reply!

Within the code you are showing, where do I add the graphic button or what should it look at? You can do an example.




[CODE]document.write('<form><input type=button value="Print this Page" name="Print" onClick="printit()"></form>');[/CODE]



Thanks!
Copy linkTweet thisAlerts:
@TheBearMayJun 05.2008 — <i>
</i>document.write('&lt;form&gt;&lt;a name="Print" onClick="printit()"&gt;&lt;img src="buttonImg.gif" /&gt;&lt;/a&gt;&lt;/form&gt;')
Copy linkTweet thisAlerts:
@CreativeMindauthorJun 05.2008 — TheBearMay, thanks, it did it!!
×

Success!

Help @CreativeMind 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.18,
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,
)...