Javascript 如何预防div';s高度放大

Javascript 如何预防div';s高度放大,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有一个页面,我应该把一些值放在一些div上,然后打印出来。这是页面的代码 <!DOCTYPE html> <html lang="ru"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css/bootstrap.css" rel="stylesheet" media="screen"> <script type="

我有一个页面,我应该把一些值放在一些div上,然后打印出来。这是页面的代码

<!DOCTYPE html>
<html lang="ru">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/bootstrap.css" rel="stylesheet" media="screen">
    <script type="text/javascript" src="scripts/jquery.js"></script>
<script src="scripts/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/styles.css" type="text/css">
<style>
   .wrapperDiv{
        background-image: url(images/forPrint.jpg);
        background-repeat: no-repeat;  
   }
</style>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script>
function ajax(a,b,c){//url,function,just a placeholder
    c=new XMLHttpRequest;
    c.open('GET',a);
    c.onload=b;
    c.send()
}
var indentionFix=0;
var topIndentionInfo=-730;
var leftIndentionInfo=100;
window.onload=function(){
 ajax('toPrinter.data',function(){
    var tickets=this.response.split(",");
    var ticketsAmount=Math.ceil(tickets.length/4);
    var ticketsCount=0;
    for(var i=0;i<ticketsAmount;i++){
        $("body").append("<div id='wrapperDiv_"+i+"' class='wrapperDiv'><img src='images/forPrint.jpg' style='visibility:hidden'/></div>");
        topIndentionInfo=-730;
        indentionFix=0;
        for(var j=0;j<4;j++){
            if(ticketsCount<tickets.length){
                console.log(this.response);
                var infoDiv=$("#wrapperDiv_"+i).append("<div id='infoDiv_"+ticketsCount+"''></div>");
                $("#wrapperDiv_"+i).css({"min-height":"500pt"})
                $("#infoDiv_"+ticketsCount).css({position:"relative",width:"200px","min-height":"140px",top:topIndentionInfo+"pt",left:leftIndentionInfo+"pt"});
                topIndentionInfo+=90;
                topIndentionInfo-=indentionFix;
                indentionFix+=3;
                var topIndentionNumber=3;
                var leftIndentionNumber=100;
                var topIndentionSurname=5;
                var topIndentionFirstSecondName=5;
                var ticketValues=tickets[ticketsCount].split("|");
                //  Добавление номеров к листу билетов
                var number=$("#infoDiv_"+ticketsCount).append("<div id=number_"+ticketValues[0]+">"+ticketValues[0]+"</div>");
                $("#number_"+ticketValues[0]).css({position: "relative", top: topIndentionNumber+"pt", left: leftIndentionNumber+"pt", "font-size":"16pt"});
                // Добавление ФИО к листу билетов
                var fioSplit=ticketValues[1].split(" ");
                var surname=fioSplit[0].toUpperCase();
                var firstSecondName=fioSplit[1]+" "+fioSplit[2];
                var surnameDiv=$("#infoDiv_"+ticketsCount).append("<div class='fio' id=surname_"+ticketValues[0]+">"+surname+"</div>");
                var firstSecondNameDiv=$("#infoDiv_"+ticketsCount).append("<div class='fio' id=firstSecondName_"+ticketValues[0]+">"+firstSecondName+"</div>");
                $("#surname_"+ticketValues[0]).css({position: "relative", top: topIndentionSurname+"pt", width:"200px", "font-size":"16pt", "min-height":"20pt"});
                $("#firstSecondName_"+ticketValues[0]).css({position: "relative", top: topIndentionFirstSecondName+"pt", width:"200px", "font-size":"16pt"});
                ticketsCount++;
            }
        }
    }
 });
}
</script>
<body class="printBody">
    <input type="button" value='Распечатать' onclick="window.print();return false;" id='print' class='btn btn-primary btn-sm'></input>
</body>
</html>

.包装师{
背景图片:url(images/forPrint.jpg);
背景重复:无重复;
}
函数ajax(a,b,c){//url,函数,只是一个占位符
c=新的XMLHttpRequest;
c、 打开('GET',a);
c、 空载=b;
c、 发送()
}
var-indentionFix=0;
var topIndentionInfo=-730;
var leftindentinfo=100;
window.onload=function(){
ajax('toPrinter.data',function(){
var tickets=this.response.split(“,”);
var ticketsAmount=Math.ceil(tickets.length/4);
var TicketCount=0;

对于(var i=0;ia工作示例是我们需要检查的。根据FIDLE,我删除了您的所有javascript,但输出也是一样的。似乎您的javascript代码编写得不好,我希望您先检查一下,或者向我们显示您面临的问题,或者显示任何图像,以便我们可以猜测