Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8820575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:38:35+00:00 2026-06-14T05:38:35+00:00

I use jQuery for this but I can’t use it now (no reason for

  • 0

I use jQuery for this but I can’t use it now (no reason for this). I need to select a portion of a table and then print it.

I use this code:

function Printon(this)
{
    newWin= window.open('','','toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=800, height=1000, left=10, top=25');
    newWin.document.write('<table>' + document.getElementsByName(this).innerHTML + '</table>');
    newWin.document.close();
    newWin.focus();
    newWin.print();
    newWin.close();
    return false;
}

When then calling the function with parameter of the <tr> names I just get a document with:

12-11-12

undefined

I am sure my HTML is correct but still here is my HTML:

<tr name="Print_1">
    <td>dhr Kees-jan ckc Von fleppenstein</td>
    <td>aquaduct straat 66<br>0606 OP ORK</td>
    <td>WDB-1352303696</td>
    <td>2822.00</td>
    <td><input type="button" value="Print this" onclick="Printon('Print_1')"></td>
    <td> &nbsp;</td>
</tr>
<tr name="Print_1">
    <td>-</td>
    <td> &nbsp;</td>
    <td> &nbsp;</td>
    <td>46.00</td>
    <td>2</td>
    <td>Actiesalade herfst</td>
</tr>
<tr name="Print_1">
    <td>-</td>
    <td> &nbsp;</td>
    <td> &nbsp;</td>
    <td>46.00</td>
    <td>2</td>
    <td>Actiesalade herfst</td>
</tr>

On inspiration of @Muthu Kumaran I use this:

function Printon(dit)
{
    var arr = new Array(); 
    arr = document.getElementsByName(dit); 
    var tabel = '';
    for(var i = 0; i < arr.length; i++){
         tabel += document.getElementsByName(dit)[i].outerHTML;
    }

    newWin= window.open('','','toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=800, height=1000, left=10, top=25');
    newWin.document.write('<table border=\"2\" cellpadding=\"2\" cellspacing=\"0\">' + tabel + '</table>');
    newWin.document.close();
    newWin.focus();
    newWin.print();
    newWin.close();
    return false;
}

Fixed it works now!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:38:36+00:00Added an answer on June 14, 2026 at 5:38 am

    Don’t use this as a argument in the function. Give a proper variable like name. Also document.getElementsByName will return array of elements, so you have to get the value by using document.getElementsByName(name)[0]

    Try this,

    function Printon(name)
    {
        newWin= window.open('','','toolbar=yes,location=no,directories=yes,menubar=yes,scrollbars=yes,width=800, height=1000, left=10, top=25');
        newWin.document.write('<table>' + document.getElementsByName(name)[0].innerHTML + '</table>');
        newWin.document.close();
        newWin.focus();
        newWin.print();
        newWin.close();
        return false;
    }
    

    Working Demo: http://jsfiddle.net/muthkum/RxNKn/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I originally used JQuery for this project, but now I'm having to use Prototype,
i try to use this jQuery plugin : http://jscrollpane.kelvinluck.com but anyway can i scrolling
I use the following jquery statements but i get error in this function onGetDataSuccess(result)
I use this script: $(document).ready(function() { $page = jQuery.url.attr(file); alert(page); }); but I get
I have an image $(#main) how can I use jquery to dosomething(this) when the
I am need paint my image. I'm trying use JQuery in here this link:
I think I need to use jQuery's index() function but I'm doing it all
I want to use a JQuery UI dialog but i can't. when I click
I have been trying to use Jquery Image maphilight plugin but can't becoz I
I already started this in javascript so I don't want to use jquery but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.