473,372 Members | 1,083 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,372 software developers and data experts.

javascript:print problem

I use a print link that causes a problem with Opera 7. The link looks
like this <a href="javascript:parent.frames.mainFrame.print()"> Print
this page</a>

I also used
<a href="javascript:print()">Print this page</a>

and it also worked with most browsers. I realize that it only works if
you have Microsoft Windows versions for PC but that is what most of
out customers have anyway. I have also noticed that there is a problem
with certain browswers, for example Explorer 4 version but also with
newer browser like Opera 7.01. I does work perfecly well with
Mozilla-compatible browsers but why not with Opera. With Opera it
first looks as if it would work, but when you choose print from the
Operating system it prints the wrong frame although i specifically try
to call the right frame. Has anyone found a workaroung or sollution to
my problem.
Jul 20 '05 #1
3 9379


Marcus Bjorke wrote:
I use a print link that causes a problem with Opera 7. The link looks
like this <a href="javascript:parent.frames.mainFrame.print()"> Print
this page</a>

I also used
<a href="javascript:print()">Print this page</a>

and it also worked with most browsers. I realize that it only works if
you have Microsoft Windows versions for PC but that is what most of
out customers have anyway. I have also noticed that there is a problem
with certain browswers, for example Explorer 4 version but also with
newer browser like Opera 7.01. I does work perfecly well with
Mozilla-compatible browsers but why not with Opera. With Opera it
first looks as if it would work, but when you choose print from the
Operating system it prints the wrong frame although i specifically try
to call the right frame. Has anyone found a workaroung or sollution to
my problem.

Well, not every browser implements the window.print method (IE4 doesn't
for instance) so you should check for it. It also helps to focus the
frame you want to print
<a href="#"
onclick="if (window.print) {
var frame = parent.frames.mainFrame;
if (frame) {
frame.focus();
frame.print();
}
}
return false;">print frame</a>
Note I haven't tested whether that improves things with Opera 7
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
DU
Martin Honnen wrote:


Marcus Bjorke wrote:
I use a print link that causes a problem with Opera 7. The link looks
like this <a href="javascript:parent.frames.mainFrame.print()"> Print
this page</a>

I also used
<a href="javascript:print()">Print this page</a>

and it also worked with most browsers. I realize that it only works if
you have Microsoft Windows versions for PC but that is what most of
out customers have anyway. I have also noticed that there is a problem
with certain browswers, for example Explorer 4 version but also with
newer browser like Opera 7.01. I does work perfecly well with
Mozilla-compatible browsers but why not with Opera. With Opera it
first looks as if it would work, but when you choose print from the
Operating system it prints the wrong frame although i specifically try
to call the right frame. Has anyone found a workaroung or sollution to
my problem.


Well, not every browser implements the window.print method (IE4 doesn't
for instance) so you should check for it. It also helps to focus the
frame you want to print
<a href="#"
onclick="if (window.print) {
var frame = parent.frames.mainFrame;
if (frame) {
frame.focus();
frame.print();
}
}
return false;">print frame</a>
Note I haven't tested whether that improves things with Opera 7


I tried a slightly modified code

<p><button type="button" onclick="top.LeftFrameName.focus();
top.LeftFrameName.print();">Print left frame only</button></p>

in a demo frameset+frames document
and Mozilla 1.5 and MSIE 6 SP2 for Windows printed accordingly only the
left frame while Opera 7.21 printed each frames one after the other.
Not too long ago, I asked in opera.general and opera.beta if it was
possible to print an iframe only and it was confirmed it was not
possible. So, I confidently believe that Opera 7.21 can not print an
individual frame (or iframe) when other browsers (Mozilla 1.5, NS 7.1,
MSIE 6) can.

DU

Jul 20 '05 #3
>
in a demo frameset+frames document
and Mozilla 1.5 and MSIE 6 SP2 for Windows printed accordingly only the
left frame while Opera 7.21 printed each frames one after the other.
Not too long ago, I asked in opera.general and opera.beta if it was
possible to print an iframe only and it was confirmed it was not
possible. So, I confidently believe that Opera 7.21 can not print an
individual frame (or iframe) when other browsers (Mozilla 1.5, NS 7.1,
MSIE 6) can.

DU

Thanks! Now i know not to bother with Opera anymore. Seems strange
that the problem has been known so long but there is no sollution.

/marcus
Jul 20 '05 #4

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

Similar topics

3
by: Andy | last post by:
Hi, I am complete JavaScript novice and would really appreciate some help with this code: ===================================================================== <%@LANGUAGE="VBSCRIPT"...
6
by: David | last post by:
Hi, I have text link on each record displayed. This needs to open a new small window for entering some data, I cannot seem to fix it ? Hyperlink Code as is: ..... RS("Manual") &...
2
by: Asad | last post by:
I have a main window that creates a new window called printWin (which contains the printable format of the page). From the main window I embed a javascript in the printWin window that calls the...
1
by: Colin Graham | last post by:
Hi, Im ammending some old asp code to update an application. I need to print out a pdf document without viewing it - can anyone help me with the necessary javascript code. I have my pdf stored...
3
by: Richard | last post by:
in a previous aspx page i got a few records printed throu window.print() function in javascript. but now i have the records in a to RTF and i want to run the same function print, which ofcourse...
3
by: HARI PRASD BARU | last post by:
want to print a page without URL address. I write Javascript:window.print() but it prints URL, date and page number. How can I hide URL? Is it possible
2
by: Kosarko | last post by:
Hello, I know this should be kind of easy, but I am very unfamiliar with Javascript. What I am looking to do is have an image (coupon) that when clicked on, it either prompts for printing...
2
by: darren | last post by:
I have a small Javascript problem with that mutch love web browser safari, I tested the code on all other browsers PC (Win) and Linux and IE on the mac and it seams to work ok, but for some reason...
2
by: toronto | last post by:
Seasons Greetings Everyone! I want to use JavaScript's event object to detect whether someone has pressed the 'PrintScreen' key to screenshot, via the Windows Clipboard, and to print website...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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...

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.