Can we make Print button without JavaScript?

2019-02-28 10:09发布

Can we make Print button without JavaScript? to open browser print window.

4条回答
叛逆
2楼-- · 2019-02-28 10:29

You could do it with a Java applet but javascript is simpler and cleaner.

查看更多
神经病院院长
3楼-- · 2019-02-28 10:41

Not with straight HTML. You could do it with Java, ActiveX, etc, but those are even more to add than JavaScript.

查看更多
ら.Afraid
4楼-- · 2019-02-28 10:46

HTML has no built-in "print" action for an anchor tag or input button (or anything else), so JavaScript is your way. You could also include instructions for your users on how to print using File->Print or the other various alternatives.

查看更多
Root(大扎)
5楼-- · 2019-02-28 10:46

Althought as @Pablo says there is no print functionality that can be used without javascript, here is something that will make it a little nicer just in case there was a user that had javascript disabled:

http://www.456bereastreet.com/archive/200709/how_to_create_an_unobtrusive_print_this_page_link_with_javascript/

查看更多
登录 后发表回答