print control with css and javascript
2005-12-16 12:34
483 查看
Sometimes we have to print a web document without some elements on it.
We can utilize gumptious css style or JavaScripts to accomplish this task that seemed be difficult.
1)css:
css style part:
<style media=print type=css/style>
.NotPrint {display:none}
</style>
html part:
<div class=NotPrint id="NotPrintPart">
<!--some innerHtml !-->
</div>
function onBeforePrint()
2
8function onAfterPrint()
9
15
html part:
<body onBeforePrint="onBeforePrint()" onAfterPrint="onAfterPrint()">
![](http://www.cnblogs.com/Images/dot.gif)
<div id=NotPrintPart ></div>
We can utilize gumptious css style or JavaScripts to accomplish this task that seemed be difficult.
1)css:
css style part:
<style media=print type=css/style>
.NotPrint {display:none}
</style>
html part:
<div class=NotPrint id="NotPrintPart">
<!--some innerHtml !-->
</div>
function onBeforePrint()
2
8function onAfterPrint()
9
15
html part:
<body onBeforePrint="onBeforePrint()" onAfterPrint="onAfterPrint()">
![](http://www.cnblogs.com/Images/dot.gif)
<div id=NotPrintPart ></div>
相关文章推荐
- [Javascript] Format console.log with CSS and String Template Tags
- Modal dialog (popup div) with javascript and css
- Creating Vista Gadgets: Using HTML, CSS and JavaScript with Examples in RSS, Ajax, ActiveX (COM) and
- [CSSinJS] Convert Sass (SCSS) Styled Button to CSSinJS with JavaScript Templates and Variables
- Beginning JavaScript and CSS Development with jQuery
- [转]Building iPhone Apps with HTML CSS and JavaScript
- Precisely control page and element backgrounds with CSS
- 海洋工作室——网站建设专家:Creating Multi-Level Navigational Menu with the ASP.NET Repeater Control and CSS Styles
- how to add Javascript and CSS in page layout with sharepoint 2013
- yii_wiki_394_javascript-and-ajax-with-yii (在yii 中使用 javascript 和ajax)
- 1st JavaScript Editor Pro 3.8,强大的JavaScript开发工具(JavaScript IDE),完美支持CSS, HTML, DOM and DHTML开发、校验、调试
- 翻译:《Beginning HTML with CSS and XHTML》序
- CSS and Round Corners: Build Boxes with Curves
- Advanced SQL Server Monitor with Performance Graph, Analysis and Version Control
- Simple Long Polling Example with JavaScript and jQuery
- [Javascript] Countdown clock with Javascript and PHP
- Mime type with javascript----text/javascript,application/javascript, and appliation/x-javascript
- 项目管理实践【五】自动编译和发布网站【Using Visual Studio with Source Control System to build and publish website automatically】
- [Javascript] Combine Objects with Object.assign and Lodash merge
- Control two computers with one mouse and keyboard