[Lodop] before css style after, before and after adding content content

css styles can content before and after adding content.
The format is:
CSS class name: before {content: content before the addition}
CSS class name: after {content: After the addition of the contents}
replaced by other means such wording in LODOP where direct testing is not enough, it is recommended , for example by stitching directly JS, or string.
content: attr (class); can type in JS available: the object class name .className acquired.
Test code:

<script language="javascript" src="LodopFuncs.js"></script>
<style id="style1">
.c1:after
{
content:attr(class);
}
.c1:before
{
content:"之前";
}
.c2{color:blue;}
</style>
</head>
<body>
<div id="div1">
<p class="c1" id="c1">这是p标签里的内容</p>
</div>
<div id="div2">
<p class="c2"This is a p tag content>= "c2"the above mentioned id</ P > 
</ div > 
< A the href = "JavaScript: prn1_preview ()" > Content additional content before and after the </ A > < br > 
< A the href = "JavaScript: prn2_preview ()" > the innerHTML additional content before and after the </ A > < br > 
< Script Language = "JavaScript" type = "text / JavaScript" >    
        var LODOP; // declare a global variable 
    function prn1_preview () {
        LODOP=getLodop(); 
        LODOP.PRINT_INIT("");
        var strBodyStyle="<style>"+document.getElementById("style1").innerHTML+"</style>";
        var strDivHtml=strBodyStyle+"<body>"+document.getElementById("div1").innerHTML+"</body>";
        LODOP.ADD_PRINT_HTM(10,10,300,200,strDivHtml);
        LODOP.PREVIEW();    
    };
    function prn2_preview() {
        LODOP=getLodop(); 
        LODOP.PRINT_INIT("");
        var p=document.getElementById("c2");
        console.log(p);
        was STRP = p.innerHTML;
        console.log(strp);
        var classP=p.className;
        console.log(classP);
        p.innerHTML = " before " + STRPs + classP;
        LODOP.ADD_PRINT_HTM(10,10,300,200,document.getElementById("c2").innerHTML);
        LODOP.PREVIEW();    
    };
</script> 
</body>

Icon:

With after, before and content to add content before and after the print design can show to preview a problem.
JS before and after use to add content, the preview normal.
(I do not recommend after, before and content to add content before and after content, can be implemented in JS or otherwise)

Guess you like

Origin www.cnblogs.com/huaxie/p/11887835.html