Results 1 to 2 of 2

Thread: Make a button trigger the javascript:window.print()

  1. #1
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking Make a button trigger the javascript:window.print()

    1) Script Title: Featured Content Slider v

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...tentslider.htm

    3) Describe problem:

    Hello! I am trying to make a button, once clicked, will trigger the browser based print using: the javascript: javascript:window.print()
    I tried doing this:

    <div class="contentdiv" onclick='javascript:window.print()'> </div>

    But will work only if I click the div under the button.

    What I wish is the button actually.

    Just in case I Attached the .js file I am currently using(since I added some features I also found here at the forum).

    Thanks in advance and more power.

    contentslider.js

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,190 Times in 3,154 Posts
    Blog Entries
    12

    Default

    Code:
    <input type="button" onclick="window.print();" value="Print">
    Or:

    Code:
    <a href="javascript:print();" onclick="window.print(); return false;">Print</a>
    Or:

    Code:
    <a href="javascript:print();" onclick="window.print(); return false;"><img src="print.gif" alt="" style="border-width: 0"></a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. 'JavaScript:window.print()';
    By squizeers in forum JavaScript
    Replies: 7
    Last Post: 11-15-2010, 03:28 PM
  2. Make trigger dissapear on click..
    By clowes in forum JavaScript
    Replies: 1
    Last Post: 03-05-2009, 04:20 AM
  3. Using Cross-browser print button to print a different page
    By egghead2000 in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 04-11-2008, 04:40 AM
  4. Javascript to Trigger Print/Save Images
    By KraftyDood in forum JavaScript
    Replies: 3
    Last Post: 12-15-2006, 06:37 PM
  5. Replies: 6
    Last Post: 07-08-2005, 03:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •