Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/go/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何中断内容编辑器并将其附加到下一页_Javascript_Jquery - Fatal编程技术网

Javascript 如何中断内容编辑器并将其附加到下一页

Javascript 如何中断内容编辑器并将其附加到下一页,javascript,jquery,Javascript,Jquery,我想在当前页面完成后将当前内容编辑器附加到下一页 这是我的小提琴 任何帮助都是值得的 描述 实际上,我正在做的是我已经创建了一个文本编辑器,在其中我添加了页眉页脚和内容编辑器,但现在我想添加一个具有相同页眉页脚的新页面,但想添加我当前的页面内容编辑器 var保证金; 页面大小; 变压头锤; 高度; var marginTopBottom; var marginLeftRight; 边缘变种; var报告高度; var报告宽度; $(函数(){ GetPage(); jQuery(“#btnGe

我想在当前页面完成后将当前内容编辑器附加到下一页

这是我的小提琴

任何帮助都是值得的

描述 实际上,我正在做的是我已经创建了一个文本编辑器,在其中我添加了页眉页脚和内容编辑器,但现在我想添加一个具有相同页眉页脚的新页面,但想添加我当前的页面内容编辑器

var保证金;
页面大小;
变压头锤;
高度;
var marginTopBottom;
var marginLeftRight;
边缘变种;
var报告高度;
var报告宽度;
$(函数(){
GetPage();
jQuery(“#btnGetSize”).on('click',function(){
var h=$(“#模板”).height();
var w=$(“#模板”).width();
变量h1=$(“#报告页”).height();
变量w1=$(“#报告页”).width();
警报(“模板:h=“+(parseFloat(h)/3.76)+”w=“+(parseFloat(w)/3.76)+”报告页:h1=“+(parseFloat(h1)/3.76)+”w1=“+(parseFloat(w1)/3.76)+”);
});
jQuery(“#ddlSize”).change(函数(){
GetPage();
});
jQuery(“#ddlargin”).change(函数(){
GetPage();
});
$(“#btnPrint1”)。在('click',函数(){
var divContents=$(“#ReportPage”).html();
var printWindow=window.open('','',高度=1000px,宽度=1000px');
printWindow.document.write(“”);
printWindow.document.write(“”);
printWindow.document.write(divContents);
printWindow.document.write(“”);
printWindow.document.close();
printWindow.print();
});
//   -------------------------
$(“#btnPrint”)。在('click',函数(){
$('#main').addClass(“页面”).css(“显示”、“无”);
$('#main').addClass(“打印页”)
var content_height=$(“#TemplateSubPage”).height();
var-page=1;
函数buildReport(){
if($('#TemplateSubPage').contents().length>0){
$page=$(“#TemplatePage”).clone();
$page.find(“.subpage”).empty();
$page.find(“.footer span”).append(第页);
$(“#报告页”)。追加($页);
$('.subpage').attr('disabled','disabled');
$(“#TemplateSubPage”).prop('disabled',true);
page++;
$(“#模板子页面”)。列化({
栏目:1,
目标:“.page:last.subpage”,
溢出:{
高度:内容高度,
id:“#模板子页面”,
doneFunc:函数(){
控制台日志(“完成页面”);
buildReport();
}
}
});
}
}
setTimeout(buildReport,1000);
});
});
//=------------------------
函数GetPage(){
pageSize=$(“#ddlSize选项:选定”).text();
页边距=$('#ddlMargin选项:选定')。text();
headerHeight=$('.header').height();
页脚高度=$('.footer').height();
marginArray=新数组();
marginArray=GetMargins();
margintopbotom=parseFloat(marginArray[0])+parseFloat(marginArray[2])+(parseFloat(headerHeight)/3.7)+(parseFloat(footerhight)/3.7);
marginLeftRight=parseFloat(marginArray[1])+parseFloat(marginArray[3]);
如果(页面大小=“--Select-->”){
//$(“#TemplatePage.divOuter”).css(“宽度”、“210mm”).css(“高度”、“290mm”);
$(“.page”).css(“宽度”、“210mm”).css(“最小高度”、“290mm”);
$(“.subpage”).css(“高度”,277+“毫米”).css(“最大高度”,290+“毫米”).css(“宽度”,187+“毫米”);
//$(“div.subpage”).css(“高度”、(290)+“毫米”).css(“最大高度”、(290)+“毫米”).css(“宽度”、(210)+“毫米”);
}
否则如果(页面大小=“A0”){
$(“.page”).css(“宽度”、“841mm”).css(“最小高度”、“1175mm”);/*页边距右上下左*/
$(“.subpage”).css(“高度”,1155+“毫米”).css(“最大高度”,1175+“毫米”).css(“宽度”,820+“毫米”);
//$(“分区子页”).css(“高度”(1175)+“毫米”).css(“最大高度”(1175)+“毫米”).css(“宽度”(841)+“毫米”);
}
else if(页面大小=“A1”){
$(“.page”).css(“宽度”,“594mm”).css(“最小高度”,“830mm”);
$(“.subpage”).css(“高度”,810+“毫米”).css(“最大高度”,830+“毫米”).css(“宽度”,574+“毫米”);
//$(“分区子页”).css(“高度”(830)+“毫米”).css(“最大高度”(830)+“毫米”).css(“宽度”(594)+“毫米”);
}
否则如果(页面大小=“A2”){
$(“.page”).css(“宽度”、“420mm”).css(“最小高度”、“585mm”);
$(“.subpage”).css(“高度”,565+“毫米”).css(“最大高度”,585+“毫米”).css(“宽度”,400+“毫米”);
//$(“div.subpage”).css(“高度”、(585)+“毫米”).css(“最大高度”、(585)+“毫米”).css(“宽度”、(420-marginLeftRight)+“毫米”);
}
否则如果(页面大小=“A3”){
$(“div.page”).css(“宽度”、“297mm”).css(“最小高度”、“413mm”);
//$(“div.subpage”).css(“高度”(413-margintopbotom)+“毫米”).css(“最大高度”(413-margintopbotom)+“毫米”).css(“宽度”(297-marginLeftRight)+“毫米”);
}
其他的
function onPageInput(event){
  //count lines in original page
  var lines = page.value.split(/\r*\n/);

  if (lines.length > linesPerPage){
    var newPage = addPage(); //returns the new page
    page.insertAfter(newPage);


    //reset original textArea value
    page.value = "";

    //populate old textarea and new textarea
    page.value = lines.slice(0, linesPerPage).join("\n");
    newPage.value = lines.slice(linesPerPage, lines.length).join("\n");

    newPage.focus();
  }
}
$(document).ready(function(){
        var page = {
              newLines : 0,
              newLinesCheck : function(){
              this.newLines = $("#TemplateSubPage").val().split('\n').length - 1;
              if(this.newLines < 0){this.newLines = 0;}
            console.warn($("#TemplateSubPage").val().split('\n'));
              },
              newLine : function(){
                this.newLines++;
              }
            };

         $(document).keydown(function(k){
            //console.log(k.which);
            if(k.which == 13){ 
              page.newLine();
              console.log(page.newLines);
            }
            if(k.which == 46 || k.which == 8){// DEL, BKSPS
                page.newLinesCheck();
            }
          });
    });