All,
I am not very familiar with javascript. However, using the following code I can successfully open, output to a new browser page, and print the contents of webpart. This part works as needed. With that the script will also open a new outlook email. I need the same content that is displayed to the web page output to the body of the email. Is this possible?
<p align="center"><input id="printpagebutton"
onclick="printpage()" type="button" value="Print Mail"/> </p>
<script type="text/javascript">
function sendmail()
{
var link = "mailto:[email protected]"
+ "[email protected]"
+ "&subject=" + escape("Help Me")
+ "&body=" + escape()
;
window.location.href = link;
}
function printpage()
{
var patt = /WebPartWPQ2/g;
var alldivs = document.getElementsByTagName('div');
var printpageHTML = '';
for(var i=0; i<alldivs.length; i++){
if(patt.test(alldivs[i].id)){
printpageHTML = '<HTML><HEAD>\n' +
document.getElementsByTagName('HEAD')[0].innerHTML +
'</HEAD>\n<BODY>\n' +
alldivs[i].innerHTML.replace('inline-block','block') +
'\n</BODY></HTML>';
break;
}
}
var printWindow = window.open('','printWindow');
printWindow.document.open();
printWindow.document.write(printpageHTML);
sendmail()
}
</script>