Printing a hidden iFrame in IE.

This solution works fine in Firefox 3.0+, but IE8/7 is just printing the entire page, not the specific iframe. This is the function that gets called when the print link is clicked: var printfunc= function(){ var url = http://someurl.aspx; //This iFrame has style="visibility: hidden; position: absolute; left: -9000px;" var printIFrame = GetObj('PrintIFrame'); printIFrame.src = url; } The aspx that gets loaded into the hidden iframe calls the print function on the onload event handler: The Print function: this.Print = function(){ self.focus(); self.print(); return false; } I've also tried this with "window" instead of "self". Both solutions work fine in FF but IE doesn't seem to get the scoping right. Any thoughts? A cross-browser solution would be great! Also, I'd rather use CSS print styles, but the content that I'm printing is different than that on the page, hence the need to load html into a hidden iframe.
Is it to a secret printer that noone knows about? (sorry, couldn't resist :) )

以上就是Printing a hidden iFrame in IE.的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏