473,395 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Q: Printing a selection (kind of)

Hi!

I have a problem that I can't find a solution to.

I have a perl script that generates reports from our NCR system for
our intranet. The NCRs are displayed on a single html page. Now I
would like to have a print button next to each NCR so that the users
can press the print button and only the nearest NCR is printed.

The problem is how can I select a single NCR in the page. I can search
for a beginning and end pattern but I don't have a clue how to select
the text in javascript.

Any idea?

Regards

Henrik Jönsson
Jul 20 '05 #1
2 3243
he************@se.transport.bombardier.com (Henrik J?nsson) writes:
I have a perl script that generates reports from our NCR system for
our intranet. The NCRs are displayed on a single html page. Now I
would like to have a print button next to each NCR so that the users
can press the print button and only the nearest NCR is printed.
I have no idea what "NCR" means, so the answer will be general.

The method I would use, is to have a special stylesheet for
media="print" and let all but one of the "NCR"'s have a class that
makes them disappear (display:none). When clicking the print button,
the appropriate NCR is set to a different class that is visible, and
then the page is printed.

Example: <URL:http://www.infimum.dk/privat/selectivePrint.html>

To see it work without spending a stack of paper, just click on one of
the "print" buttons, cancel the printing, and look at the print
preview.
The problem is how can I select a single NCR in the page. I can search
for a beginning and end pattern but I don't have a clue how to select
the text in javascript.


If you control the Perl script, then you can just wrap each NCR in a
div element with a unique id, and let the print button find the
element using document.getElementById("uniqueId42"). I am lazy, so in
the example, I just put the button inside the div and used parentNode.

If you don't have a single block surrounding the NCRs, and for some
reason is not allowed to change that, then you will have to find another
way to affect the elements. It is most likely much harder.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Thanks!

Exactly what I needed. BTW, NCR stands for a non conformity report,
aka change request, defect report etc.

/henrik
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
16
by: gb | last post by:
Hi All, Ive created a popup page using 'var openWindow = window.open("new","pop")' And added content using openWindow.document.write(" "); statements. But now I would like to be able to print...
0
by: mykidisgollum | last post by:
Greetings, I have code which prints a document who's attributes are saved as flags in a database. One of the those attributes is letter or legal. When I am printing, I use the following...
1
by: Pohihihi | last post by:
Hello NG. I am using System.Drawing.Printing NS to print few label style printouts. I figured out how the basics goes in that namespace but there are still few things that is holding me up from...
2
by: Jacek | last post by:
I'm developing ASP.NET C# application. I need to implement server-side printing for asp.net form on specified in DB printer. I know how to print it on Client-side (window.print()). How can I print...
0
by: Ian | last post by:
Hi, I want to print a selection of pages from a PrintDocument. I have enabled the SomePages facility on the PrintDialog, and I am thus using the .FromPage and .ToPage properties of the...
3
by: D Witherspoon | last post by:
No matter what I do the default paper size is always either A3 or 11 by 8.5 .. Here is the code. Dim dlg As DialogResult pd.DocumentName = "Weld Image" Dim pkPaperSize As New...
6
by: Siv | last post by:
Hi, I am getting into printing with VB.NET 2005 and want to implement the usual capability that a user can select a selection of pages. I have a report that is generated by my application that if...
0
by: GiftX | last post by:
VB 6.0 And Spreadsheet - Printing problem Good morning West. After much research, I found this code. It scans the spreadsheet and returns up to the last used cell. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.