Welcome to WebmasterWorld Guest from 23.22.79.235

Forum Moderators: open

Message Too Old, No Replies

Using the window.print() method in Javascript

Crossbrowser support

   
4:54 pm on Jun 5, 2003 (gmt 0)

10+ Year Member



Hello

I have a web page at the following url

<snip>

At the bottom of the page is a link to print the page. Now this seems to work on Windows PC's but not on Mac in Internet Explorer.

The code i have used is below and I just wondered if any one knew of a way to get this to work in Explorer. The code seem to work in Netscape on the Mac and as I have said there is no problem in Explorer on windows PC's

<a href="JavaScript: onclick=window.print();" class="hlink">print</a>

Any ideas on this would be appreciated.

Cheers

[edited by: korkus2000 at 5:07 pm (utc) on June 5, 2003]
[edit reason] no personal URLs please [/edit]

5:14 pm on Jun 5, 2003 (gmt 0)

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



IE5+ will do window.print. Call the method without the onclick in the href like:

<a href="JavaScript:window.print();" class="hlink">print</a>

5:22 pm on Jun 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Save the code and drop the link. "Print" is just a mouseclick or keystroke away by default.