前端开发填坑记

input输入框必须指定最大长度

新建打印窗口,打印不全的问题

    printWin = window.open("", "newwin", "");
    //printWin.document.write(printHtml);
    //printWin.document.close();
    printWin.document.body.innerHTML= printHtml;
    printWin.window.print();
    printWin.close();

jQuery选择器中含有特殊字符的问题

用两个/转义

1    
var $id_a = $('#id.a');//jQuery对象,实际上是没取到元素的    

Continue reading

前端打印高度显示不全的问题

最近在写页面打印功能的时候,发现当页面超过一定高度的时候,打印时只会截取中间一部分打印出来。于是我在想会不会是打印时overflow样式的问题。于是在stackoverflow上找到了如下解答:

https://stackoverflow.com/questions/16221412/css-media-print-causes-part-of-the-page-to-be-cut-off-during-printing-in-ie

Printing CSS:

  1. Make sure all print floats are: float none;
  2. Make sure your body is overflow-y: visible;
  3. Make
Continue reading