/    Sign up×
Community /Pin to ProfileBookmark

printing an alert message?

I have an alert box come up, and I would like the alert box to be printed. I have tried using the window.print() command but that printed the entire webpage. Is there anyway to just have the alert print? Thanks.

Here is my function that calls the alert box.

[CODE]
<scpript>

function final()
{
alert(“You got ” + numCorrect + ” out of 42 questions correct.n” + “Your grade is ” + Math.round(100*numCorrect/42) + “%n”)
window.print();
}

</script>
[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@slaughtersFeb 20.2008 — Execute the final function within an iframe that is kept invisible until you call it except simply print out the value instead of using an alert box.
Copy linkTweet thisAlerts:
@lchswebauthorFeb 20.2008 — I sort of new to JavaScript, so how would I go about doing that?
×

Success!

Help @lchsweb 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.17,
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,
)...