0

我有一个 aspx 页面,我想在我的应用程序中用作注册人帐户的打印版本。

在该页面中,我有以下代码,基本上包括一个很长的表格,该表格延伸到多个 A4 页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PrintAccountDetails.aspx.cs" Inherits="protected_PrintAccountDetails" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Print Account Details</title>

</head>
<body style="margin: 0;">


    <asp:Panel runat="server" Width="210mm" Style="margin: 0 auto;">
      <br /><br />
            <asp:Label ID="Label8" runat="server" Font-Underline="True">Financial Information -Trading Experience</asp:Label>
            <br />
            <br />
            <asp:Label ID="Label9" runat="server" Font-Underline="False" Font-Bold="True">Answers on questionnaire</asp:Label>
            <br />
            <br />
            <table style="width: 100%">
                <tr>
                    <td style="width: 70%">
                        <ul>
                            <li id="q66" runat="server">Main Shareholders - partners - members with more than 25%
                                share - 1</li>
                        </ul>
                    </td>
                    <td style="width: 30%">
                       <%= PrintAnsw66.Trim() %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <ul>
                            <li id="q67" runat="server">Main Shareholders - partners - members with more than 25%
                                share - 2</li>
                        </ul>
                    </td>
                    <td>
                        <%= PrintAnsw67.Trim() %>
                    </td>
                </tr>
                  .
                  .(Many more <tr>s of two cells)
                  .
                  .
               </table>
     </asp:Panel>
</body>

当我尝试在 IE9 中打印该页面时,接近分页符的 tr 无法正确打印。恰好接近分页符的 tr 在前一页中有它的 2d 单元格,而在应该是的页面中 SAME 行的第一个单元格。在 FF 和 Chrome 中,表格的每一行甚至分页符中的行都被打印在一起,没有奇怪的行为。

有谁知道可能是什么问题,我该如何解决?提前致谢!


jQuery/JavaScript 脚本在 IE7 上不起作用

我在 Internet EXPLODER 7.0 上遇到 jquery/javascript 问题。在现代浏览器(包括 IE 8 和 9)上一切正常。IE 7 不隐藏元素,不显示日期选择器 - 总体而言,该脚本不像在其他“普通”浏览器上那样工作。

这是我的 jsfiddle:http: //jsfiddle.net/W7NHK/

如果有任何帮助,我将不胜感激!

这是我的html:

<fieldset>


<div class="type-text">

  <label for="date_from">Date1:</label>
  <input type="text" size="20" id="date_from" name="rent-a-car[date_from]" value="" readonly="readonly" />
</div>


<div class="type-select">

    <label for="time_from_hour">Hour1: </label>
    <select id="time_from_hour" name="rent-a-car[time_from_hour]" class="select">
        <option value="">---</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
    </select>
    <span> : </span>

    <label for="time_from_minute" style="display: none;">minute1: </label>
    <select id="time_from_minute" name="rent-a-car[time_from_minute]" class="select">
        <option value="">---</option>
        <option value="00">00</option>
        <option value="15">15</option>
        <option value="30">30</option>
        <option value="45">45</option>
    </select>

</div>

<div class="type-select">

    <label for="get_car">City1:</label>
    <select id="get_car" name="rent-a-car[get_car]" class="select">
        <option value="">---</option>
        <option value="Katowice">Katowice</option>
        <option value="Kraków">Kraków</option>
        <option value="Warszawa">Warszawa</option>
        <option value="Wrocław">Wrocław</option>
        <option value="Gdańsk">Gdańsk</option>
    </select>

</div>


<div class="type-select">

    <label for="get_city_district" style="display: none;">District </label>
  <select id="get_city_district" name="rent-a-car[get_city_district]" class="select">
        <option id="e1a" value="direction1">direction1</option>
        <option id="e1b" value="direction2">direction2</option>
        <option id="e2a" value="direction3">direction3</option>
        <option id="e2b" value="direction4">direction4</option>
        <option id="e3a" value="direction5">direction5</option>
        <option id="e3b" value="direction6">direction6</option>
        <option id="e4a" value="direction7">direction7</option>
        <option id="e4b" value="direction8">direction8</option>
        <option id="e5a" value="direction9">direction9</option>
        <option id="e5b" value="direction10">direction10</option>
        <option id="e6" value="direction11">direction11</option>
        <option id="e8" value="direction12">direction12</option>
  </select>

</div>

</fieldset>



<fieldset>


<div class="type-text">

  <label for="date_to">Date2:</label>
  <input type="text" size="20" id="date_to" name="rent-a-car[date_to]" value="" readonly="readonly" />
</div>


<div class="type-select">

    <label for="time_to_hour">Hour2: </label>
    <select id="time_to_hour" name="rent-a-car[time_to_hour]" class="select">
        <option value="">---</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
    </select>
    <span> : </span>

    <label for="time_to_minute" style="display: none;">minute: </label>
    <select id="time_to_minute" name="rent-a-car[time_to_minute]" class="select">
        <option value="">---</option>
        <option value="00">00</option>
        <option value="15">15</option>
        <option value="30">30</option>
        <option value="45">45</option>
    </select>

</div>


<div class="type-select">

    <label for="return_car">City2:</label>
    <select id="return_car" name="rent-a-car[return_car]" class="select">
        <option value="">---</option>
        <option value="Katowice">Katowice</option>
        <option value="Kraków">Kraków</option>
        <option value="Warszawa">Warszawa</option>
        <option value="Wrocław">Wrocław</option>
        <option value="Gdańsk">Gdańsk</option>
    </select>

</div>

    <div class="type-select">

    <label for="return_city_district" style="display: none;">Odstawienie samochodu: </label>
  <select id="return_city_district" name="rent-a-car[return_city_district]" class="select">
        <option id="d1a" value="direction1">direction1</option>
        <option id="d1b" value="direction2">direction2</option>
        <option id="d2a" value="direction3">direction3</option>
        <option id="d2b" value="direction4">direction4</option>
        <option id="d3a" value="direction5">direction5</option>
        <option id="d3b" value="direction6">direction6</option>
        <option id="d4a" value="direction7">direction7</option>
        <option id="d4b" value="direction8">direction8</option>
        <option id="d5a" value="direction9">direction9</option>
        <option id="d5b" value="direction10">direction10</option>
        <option id="d6" value="direction11">direction11</option>
        <option id="d7" value="direction12">direction12</option>
  </select>

</div>

</fieldset>



<fieldset>

  <div style="display:none;">

<div class="type-text">

  <label for="total_hour1"> </label>
  <input type="text" size="20" id="total_hour1" name="rent-a-car[total_hour1]" value="" readonly="readonly" />
</div>


<div class="type-text">

  <label for="total_hour2"> </label>
  <input type="text" size="20" id="total_hour2" name="rent-a-car[total_hour2]" value="" readonly="readonly" />
</div>

  </div>

<div class="type-text">

  <label for="finish_day">Total day: </label>
  <input type="text" size="20" id="finish_day" name="rent-a-car[finish_day]" value="" readonly="readonly" />
</div>

    <div id="three_day">Sample TXT</div>


</fieldset>

和我的js:

var today = new Date().getDay();
    var tomorrow = new Date();
    tomorrow.setDate(tomorrow.getDate() + 1);
    tomorrow.setHours(0, 0, 0, 0);
var disabledDays = ['15/8/2012', '1/11/2012', '11/11/2012', '25/12/2012', '26/12/2012'];
function noWeekendsOrHolidays(date) {
     var noWeekends = $.datepicker.noWeekends(date);
     var holiday = $.inArray($.datepicker.formatDate('d/m/yy', date), disabledDays) > -1;
     var friSat = today >= 5 && date.getTime() == tomorrow.getTime();
     return [!friSat];
}

$(function () {

var disabledDays = ['15/8/2012', '01/11/2012', '11/11/2012', '25/12/2012', '26/12/2012'];

$.datepicker.setDefaults({
    dateFormat: 'dd/mm/yy', dayNamesMin: ['Nie', 'Pon', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'],
    dayNames: ['Niedziela','Poniedzialek','Wtorek','Środa','Czwartek','Piątek','Sobota'],
    monthNamesShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'],    
    changeMonth: true, changeYear: true, numberOfMonths: 1, constrainInput: true, firstDay: 1});

$('#date_from, #date_to').datepicker({
    beforeShowDay: noWeekendsOrHolidays,
    defaultDate: '+1d', minDate: '+1d',
    onSelect: function (dateText, inst) {        
        var dateMin = $('#date_from').datepicker('getDate');            
        var dateMax = $('#date_to').datepicker('getDate');            
        if (this.id == 'date_from') {            
            var rent_date_from = new Date(
                dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate() + 1);            
            var rent_date_to = new Date(
                dateMin.getFullYear(), dateMin.getMonth(), dateMin.getDate() + 29);            
            $('#date_to').datepicker('option', {minDate: rent_date_from, maxDate: rent_date_to});        
        }        
        $('#day_of_week1').val($.datepicker.formatDate('DD', dateMin));        
        $('#day_of_week2').val($.datepicker.formatDate('DD', dateMax));

        // sprawdzenie czy dzien nalezy do swiat - odbior
        if( $.inArray($("#date_from").val(), disabledDays)>=0) {  
            var freeday_value = 'holiday';
            $('#weekend_day1').val(freeday_value);
        }else{
            $('#weekend_day1').val('');
        }
        // sprawdzenie czy dzien nalezy do swiat - zwrot
        if( $.inArray($("#date_to").val(), disabledDays)>=0) {  
            var freeday_value = 'holiday';
            $('#weekend_day2').val(freeday_value);
        }else{
            $('#weekend_day2').val('');
        }

        compute(); //Add compute    
    }
    });

    $.viewMap_get = { // pokazwywanie wartoci w zaleznosci od wybranego miasta
        '0': $([]),
        'Katowice': $('#e1a, #e1b, #e6, #e8'),
        'Kraków': $('#e2a, #e2b, #e6, #e8'),
        'Warszawa': $('#e3a, #e3b, #e6, #e8'),
        'Wrocław': $('#e4a, #e4b, #e6, #e8'),
        'Gdańsk': $('#e5a, #e5b, #e6, #e8')
    };

    $.each($.viewMap_get, function() { $(this).remove(); });
    $('#get_city_district').hide();

    $('#get_car').on('change', function() {
        // hide all
        $.each($.viewMap_get, function() { $(this).remove(); });
        $('#get_city_district').hide();
        // show current
        $('#get_city_district').append($.viewMap_get[$(this).val()]).show();

        var id = $.viewMap_get[$(this).val()].attr("id");   
        $('#'+id).attr('selected', 'selected');
    });

    $.viewMap_return = {
        '0' : $([]),
        'Katowice' : $('#d1a, #d1b, #d6, #d7'),
        'Kraków' : $('#d2a, #d2b, #d6, #d7'),
        'Warszawa' : $('#d3a, #d3b, #d6, #d7'),
        'Wrocław' : $('#d4a, #d4b, #d6, #d7'),
        'Gdańsk' : $('#d5a, #d5b, #d6, #d7')
    };

    $.each($.viewMap_return, function() { $(this).remove(); });
    $('#return_city_district').hide();

    $('#return_car').on('change', function() {

        $.each($.viewMap_return, function() { $(this).remove(); });
        $('#return_city_district').hide();
        // show current
        $.viewMap_return[$(this).val()].show();
        $('#return_city_district').append($.viewMap_return[$(this).val()]).show();

        var id = $.viewMap_return[$(this).val()].attr("id");
        $('#'+id).attr('selected', 'selected');
    });

    function compute() {
        var c = $('select#time_from_hour').val();
        var d = $('select#time_from_minute').val();
        var e = $('select#time_to_hour').val();
        var f = $('select#time_to_minute').val();
        var g = $('input#date_from').val();
        var h = $('input#date_to').val();
        date1= g.split("/");
        var timestamp = (new Date(date1[2],date1[1],date1[0],c,d).getTime()/1000) + 7200;
        $('#total_hour1').val(timestamp);

        date2= h.split("/");
        var timestamp = (new Date(date2[2],date2[1],date2[0],e,f).getTime()/1000) + 7200;
        $('#total_hour2').val(timestamp);

        var x = -$('input#total_hour1').val();
        var y = -$('input#total_hour2').val();
        var total_time = x - y;
        result = total_time / 86400;
        new_number = Math.ceil(result);

        if(isNaN(new_number)) {
          var new_number = 0;
        }
        $('#finish_day').val(new_number);

        if( parseInt($("#finish_day").val()) < 4 ) {
            $('#return_car').children('option[value=' + $('#get_car').val() + ']').prop('disabled', false).attr('selected', true).siblings().prop('disabled', true);

            if ($('#return_car').val()) $('#return_car').change();
        }
        else {
            $('#get_car > option, #return_car > option').prop('disabled', false);
            $('#three_day').hide(2000, function () {
                $(this).remove();
            });
        }

    }

    //$('#three_day').hide();

    // zaznaczanie tej samej godziny i minuty
    $('#time_from_hour').change(function () {
        $('#time_to_hour').val($(this).val());
    });

    $('#time_from_minute').change(function () {
        $('#time_to_minute').val($(this).val());
    });

    // linijki konieczne do wykonania funkji compute

    $('select#time_from_hour').change(compute);
    $('select#time_from_minute').change(compute);
    $('select#time_to_hour').change(compute);
    $('select#time_to_minute').change(compute);
    //$('select#return_car').change();
    $('select#get_car').change(compute);
    $('input#finish_day').change(compute);

    $("#birthday").datepicker({
        yearRange: '1950:2010',
    });

    // konkiguracja wywietlania bledu
    $(".error").mouseover(function () {
        $(this).hide(2000, function () {
            $(this).remove();
        });
    });


});
4

2 回答 2

1

基本思想是用 div 替换表格。

原因是如果表格中断(当资源管理器尝试打印它时),那么结果可能不会像你喜欢的那样,但是 div 可以在其中一行中断而不改变它们继续时的视图下一页。

我看到你的表实际上是两列 70%-30%,所以很容易用 div 来制作。

这里有一些例子: http:
//matthewjamestaylor.com/blog/equal-height-columns-2-column.htm
http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/ http://www .thesitewizard.com/css/design-2-column-layout.shtml

于 2012-10-23T07:33:47.100 回答
0

这是 IE9 渲染问题:http ://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/e6f49d52-ec3f-47c5-802e-b80d1a58ed39/

我找不到票的链接,但它存在。

要解决此问题,您需要删除表格元素结束标记和下一个表格单元格开始之间的所有空格和换行符。换句话说,使 td, tr 在同一行,彼此相邻,中间没有空格。

于 2012-10-23T07:34:42.510 回答