• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

window.Print() not working.

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using two frames, in my first frame my "Print" button is there and from that button I want to print the another frame's document(HTML CSS).
So for that I have written the following Function:
function printReport()
{
parent.Main.focus();//"Main is my second Frame's name which I want to Print.
window.print();
}
The above function works well in IE but in netscape 6, nothing happens , it also doesn't give me any error message.
If any one have any idea about my problem please respond.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quoted from O'Reilly Javascript book (the rhino book)

Simulates a click on the browser's Print button. IE5 and Netscape4 only


Looks like you're out of luck
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:

It is tested in Netscape 7 Priview Release 1, Netscape 4.79 and Internet Explore 6 sp1
/Rene
 
Ashwani Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
Thanks for the quick response, but by using this function I am getting access denied arror.
As my Print button in upper frame and the document which I want to print is lower one(i.e. main--Frame name).
 
Ashwani Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya now print pop up is opened on call of this function but it prints only the upper frame where as i am giving name of lower frame to print.
 
Rene Larsen
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is how I did it:
index.html

top.html

main.html

Is this the way you are doing it too or almost to way?
/Rene
 
Ashwani Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
As said by you that following code is working, although I have seen ur code also that is working fine.
Actually in My second frame i.e. Main, I am generating Report in HTML CSS and that i want to be printed.
In the following function it is not going beyond
parent.Main.focus().
Could you please suggest me something regarding this.
---------------------------------------
<script language="javascript">
function printReport()
{
alert("Before if condition");
if (window.print)
{
alert("After if condition");
parent.Main.focus();
alert("After focus----");
parent.Main.print();
alert("Over");
}
}
</script>
------------------------------------
 
Ashwani Yadav
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The above witten function gives error "Access denied" when the frame which I am printing conatins HTML CSS document.
Does any body knows abot this?
reply
    Bookmark Topic Watch Topic
  • New Topic