0

`

.styled-button-2 {

-webkit-box-shadow: rgba(0, 0, 0, 0.0976562) 0px 1px 0px 0px;

background-color: #EEE;

border: 1px solid #999;

color: #666;

font-family: 'Lucida Grande', Tahoma, Verdana, Arial, Sans-serif;

font-size: 11px;

font-weight: bold;

padding: 2px 6px;

height: 28px;

}

//Controls which Web Part or zone to print

var WebPartElementID = "webpartzone1";

//Function to print Web Part

function PrintWebPart()

{ var bolWebPartFound = false;

if (document.getElementById != null)

{

//Create html to print in new window

var PrintingHTML = '\n\n';

//Take data from Head Tag

if (document.getElementsByTagName != null)

{

var prButton = document.getElementById('printButton');

    prButton.style.display = 'none';

var HeadData= document.getElementsByTagName("HEAD");

if (HeadData.length > 0)

PrintingHTML += HeadData[0].innerHTML;

}

PrintingHTML += '\n\n\n';

var WebPartData = document.getElementById(WebPartElementID);

if (WebPartData != null)

{

window.print(); }

else

{ bolWebPartFound = false;

alert ('Cannot Find Web Part');

} } PrintingHTML += '\n\n';

//Open new window to print

if (bolWebPartFound)

{

var PrintingWindow = window.open ("","PrintWebPart", "toolbar,width=800,height=600,scrollbars,resizable,menubar");

PrintingWindow.document.open();

PrintingWindow.document.write(PrintingHTML);

// Open Print Window

PrintingWindow.print();

}

prButton.style.display = '';

}

New window is opened while hitting the print button, but blank page with script error alone showing

  • So what error or output are you getting?? – Rahul Gokani Jun 28 '13 at 9:21
  • New window is opened while hitting the print button, but blank page with script error alone showing – Arul Jun 28 '13 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.