How to print <Iframe> tag content from JavaScript ?

Last post 07-03-2009 2:05 PM by srinivaskotra. 2 replies.

Sort Posts:

  • How to print <Iframe> tag content from JavaScript ?

    07-03-2009, 8:34 AM
    • Member
      14 point Member
    • anup_phansa
    • Member since 04-25-2007, 12:49 PM
    • Posts 115

    HI all


    How to print <Iframe> tag content from JavaScript ?


    I am using <Iframe> tag for displaying google map on my page

     

    Given below javascript code, I am using for printing a content of iframe

     

                var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,resizable=yes,";

                    disp_setting+="scrollbars=yes,width=750, height=600, left=100, top=0";

     

                var WinPrint = window.open('','',disp_setting);

     

            WinPrint.document.write(vContent);

            WinPrint.document.close();

            WinPrint.focus();

            WinPrint.print();    


    it is working fine in mozilla but not working in IE please give me solution , if any onother option then please infome me 


    regards

    anup phansa


  • Re: How to print <Iframe> tag content from JavaScript ?

    07-03-2009, 11:00 AM
    Answer
  • Re: How to print <Iframe> tag content from JavaScript ?

    07-03-2009, 2:05 PM
    Answer

     Hi,

    <script language=JavaScript>

    function CheckIsIE()
    {
    if (navigator.appName.toUpperCase() == 'MICROSOFT
    INTERNET EXPLORER') { return true;}
    else { return false; }
    }


    function PrintThisPage()
    {

    if (CheckIsIE() == true)
    {
    document.ifWorkspace.focus();
    document.ifWorkspace.print();
    }
    else
    {
    window.frames['ifWorkspace'].focus();
    window.frames['ifWorkspace'].print();
    }

    }

    </script>

     ------------ or ----------------

    <script type="text/javascript">
    function PrintIframe()
    {

    frames["IframeName"].focus();
    frames["IframeName"].print();
    }
    </script>
    </head>

    refer here

    http://bytes.com/groups/javascript/91919-printing-iframe

    Thanks :)

     

    Remember to click “Mark as Answer” on the post, if it helps you. Because It helps others to find the solution.

    Srinivas Kotra.


Page 1 of 1 (3 items)