开发者

How to implement print effect like this page? [closed]

开发者 https://www.devze.com 2022-12-11 13:09 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years 开发者_开发知识库ago.

http://losangeles.kijiji.com/c-PrintAd?AdId=167716102


Viewing the page's source code, I see:

<body onload="OnLoad();window.print();" onunload="OnUnload()">

It's the window.print(); you're interested in.

Although a matter of personal choice, I'm not a fan of web pages invoking system dialogs. It's that whole "don't take control of my computer" thing, like sites that maximize the browser, try to pop-up windows, etc. I'll call a link "Printer Friendly Version" rather than "Print this Page", assuming the user can figure out how to do File -> Print.


Add this to the bottom of a page, and the print dialog will pop up.

<script type="text/javascript">
window.print();
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消