开发者

Workaround for FF printing fieldset truncated to one page (bug 471015)

开发者 https://www.devze.com 2023-02-20 23:43 出处:网络
When printing a document, Firefox truncate <fieldset> to one page. This mean that a form with a <fieldset> that would take more than one page in print can not be printed correctly. This is

When printing a document, Firefox truncate <fieldset> to one page. This mean that a form with a <fieldset> that would take more than one page in print can not be printed correctly. This is apparently a known bug tracked on bugzilla since 2008 (seebug 471015).

Is there a workaround (CSS or other) that allow printing of a single <fieldset开发者_如何学JAVA> on several pages ? (other than not using <fieldset>) ?


Check out this jQuery hack I just wrote to solve this issue, figured I'd share even though I'm a year late. You can change "printEnclosure" to an HTML tag I believe and the CSS at the end is obviously optional.

<div id="printEnclosure">
<fieldset>
<legend>TEST</legend>

Test Content goes here...
</fieldset>
</div>

<script type="text/javascript">
/* <![CDATA[ */
$(document).ready(function()
{
        $('#printEnclosure').find('fieldset').each(function(i)
        {
            $(this).replaceWith('<div id="convertedfieldset'+i+'">'+$(this).html()+'</div>');
            $('div#convertedfieldset'+i).css('display','inline').css('text-align','left');
        });
});
/* ]]> */
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号