SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2009
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Print with jQuery: part of page

    I have posted a thread in PHP section http://www.sitepoint.com/forums/showthread.php?t=737982
    Thinking if it is possible to solve using Javascript with/without jQuery.
    I need to print one form from Multiple forms in one page

    I am planning to make a page which will contain 6 receipt form. [Six form in One page]. When the form filled up, then jQuery Ajax will submit the form without reloading the page, and there will also be 6 different button to print each individual form.


    N.B. One person give a hints that, I need 6 id with 6 listener. I need little more detail guideline.

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2009
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @SgtLegend,
    I actually need to make option for mutiple print option [for each form, individually] in one page.
    Your given link is only a for Form plugin.

    Thanks for your time.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    4 Thread(s)
    That could most easily be done by applying a different CSS print stylesheet, depending on which form you want the print stylesheet to display.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Feb 2011
    Location
    Virginia
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    give six unique ids for forms and when click on print button create a print window, write html content related print area, print this window and close.

    here is the sample code i have created in my page
    call the below function on print button click by passing unique id

    function print(id)
    {

    var html="<html>";
    html+="<head>";

    html+="<link rel='Stylesheet' type='text/css' href='css/print.css' media='print' />";
    html+="</head>";
    html+= document.getElementById(id).innerHTML;
    html+="</html>";

    var printWin = window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
    printWin.document.write(html);
    printWin.document.close();
    printWin.focus();
    printWin.print();
    printWin.close();
    }

  6. #6
    SitePoint Zealot
    Join Date
    Mar 2009
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot. I am going to try it soon.

  7. #7
    SitePoint Member
    Join Date
    Feb 2011
    Location
    Virginia
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


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
  •