...

View Full Version : Printing web part using Javascript and jquery



uzn
07-11-2011, 06:02 PM
I'm newbie to javascript. I'm trying to print a web part in landscape orientation. I want to include CSS in java script and change the layout of the page. Here is the print code



function printWebPart(tagid)
{
if (tagid)
{
var html = "<HTML>\n<head>\n"+
$("HEAD").html()+
"\n</head>\n<body >\n"+
$("#"+tagid).html()+
"\n</BODY>\n</HTML>";
var printWP = window.open("","printWebPart");
printWP.document.open();
printWP.document.write(html);
printWP.document.close();

printWP.print();
printWP.close();

}
}
</script>

and here is the css class :
.landScape
{
width: 100%;
height: 100%;
margin: 0% 0% 0% 0%;
filter: progid:DXImageTransform.Microsoft.BasicImage(Rotation=3);
}

Please suggest how do i do this?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum