/*--- --------------------------------------------------------------------------------------- ---- Blog Entry: Ask Ben: Print Part Of A Web Page With jQuery Author: Ben Nadel / Kinky Solutions Link: http://www.bennadel.com/index.cfm?event=blog.view&id=1591 Date Posted: May 21, 2009 at 9:10 PM ---- --------------------------------------------------------------------------------------- ---*/ // Create a jquery plugin that prints the given element. jQuery.fn.print = function (options) { var defaults = $.extend({ ver: 1, csspath: null }, options); // NOTE: We are trimming the jQuery collection down to the // first element in the collection. if (this.size() > 1) { this.eq(0).print(); return; } else if (!this.size()) { return; } // ASSERT: At this point, we know that the current jQuery // collection (as defined by THIS), contains only one // printable element. // Create a random name for the print frame. var strFrameName = ("printer-" + (new Date()).getTime()); // Create an iFrame with the new name. var jFrame = $("