日期:2014-05-16  浏览次数:20370 次

大神来指点下如何用JS实现重复为HTML模版填值
需要用网页实现批量的打印报表的功能,创建了HTML模版如下:
<!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>
    <title></title>

    <script type="text/javascript">


function Print()
{
//document.body.innerHTML=document.getElementById('myprint').innerHTML;
document.getElementById('opBtn').style.display="none";              
window.print();

//var res = csharpActiveX.Print("Print/HandlerPrint.ashx?StuNo='"+@StuNo+"'&LSH='"+@Id+"'");

//            if (res == 'success') {
//                
//                setTimeout("window.location = '/Web/Student/charge/chargeStudent.aspx'", 2000);
//                //;
//            } else if (res == 'reqError') {
//                alert("已打票,但是缴费单状态未成功更新");
//            }
  
}
    </script>

    <style type="text/css">
        #myprint
        {
            width: 540px;
            height: 315px;
            border: 0px solid black;
            border: 0px solid black;
            margin: 0 auto;
            background-image: url(   'bbb.jpg' );
        }
        #myprint .title
        {
            font-family: 黑体;
            font-size: 16px;