3 var printAreaCount = 0;
5 $.fn.printArea = function()
9 var idPrefix = "printArea_";
11 removePrintArea( idPrefix + printAreaCount );
15 var iframeId = idPrefix + printAreaCount;
16 var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
18 iframe = document.createElement('IFRAME');
20 $(iframe).attr({ style : iframeStyle,
24 document.body.appendChild(iframe);
26 var doc = iframe.contentWindow.document;
28 $(document).find("link")
30 return $(this).attr("rel").toLowerCase() == "stylesheet";
33 doc.write('<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >');
36 doc.write('<div class="' + $(ele).attr("class") + '">' + $(ele).html() + '</div>');
39 var frameWindow = iframe.contentWindow;
45 var removePrintArea = function(id)
47 $( "iframe#" + id ).remove();