javascript 打印_如何创建JavaScript打印链接

javascript 打印

Oftentimes a novice web user wont think to do something unless they are presented with the option to do so. I've found this to be true of many of the websites I make. I've added "email to a friend" functionality to customer websites and traffic seems to increase (albeit a fraction, but every bit helps).

经常,新手Web用户不会考虑做某事,除非向他们提供这样做的选项。 我发现这对我创建的许多网站都是正确的。 我已经向客户网站添加了“发送给朋友的电子邮件”功能,并且访问量似乎有所增加(尽管有所增加,但一点点都有帮助)。

Some websites are helped by adding a JavaScript "print" link. If you have a page with a coupon, for example, or a page that acts as a promotional piece, I recommend adding a "print" link. Users will get your subtle message and that could mean increased business / traffic.

通过添加JavaScript“打印”链接可以帮助某些网站。 例如,如果您有一个带有优惠券的页面或一个用作促销品的页面,则建议添加“打印”链接。 用户会收到您的微妙信息,这可能意味着业务/流量的增加。

代码 (The Code)

Some quick JavaScript in the "href" attribute of the anchor will accomplish this goal.

锚点的“ href”属性中的一些快速JavaScript将实现此目标。

<a href="javascript:window.print();">Print</a>

Be sure not to put the JavaScript in the onClick attribute of the anchor -- not everyone clicks a link.

确保不要将JavaScript放在锚点的onClick属性中-并非每个人都单击链接。

翻译自: https://davidwalsh.name/javascript-print

javascript 打印

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值