SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast Devilware's Avatar
    Join Date
    Oct 2005
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question creating a print-friendly page Error

    Hello Friends:
    I'm in a trouble with print page in my articles pages . I just added a link to create
    print friendly page. and I 've specified the <div id="PrintContent">........</div> to
    take the content to popup window to display print page for content and a link
    is <a href="Javascript:PrintThisPage()">print this page</a> .although the script as follows:


    <script>
    function PrintThisPage() {
    var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,";
    disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
    var content_value=document.getElementById("PrintContent").innerHtml;
    var docprint=window.open("","",disp_setting);
    docprint.document.open();
    docprint.document.write('<html><head><title>صفحة الطباعة</title>');
    docprint.document.write('</head><body onLoad="self.print()"><center>');
    docprint.document.write(content_value);
    docprint.document.write('</center></body></html>');
    docprint.document.close();
    docprint.focus();
    }


    the code runs well except the content doesn't show up in the popup window . it shows only one
    word 'undefined' can some one tell me how to solve it.

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Try innerHTML instead of innerHtml


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •