请教各位高手这个页面里有一个css属性 <style >
@media print{ BODY {display:none}} /* 防打印 */
</style> 作用是,使页面不能被打印。现在我要加一个按钮,只有在点击的时候才能够打印页面。
现在的主要问题是不知道这段js应该怎么写,才能够修改 @media print 里的打印属性
页面的代码如下<style >
@media print{ BODY {display:none}} /* 防打印 */
</style> <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0>
</OBJECT><input type="button" value="打印" onclick ="document.body.style.cssText='color:red';wb.execwb(6,1)">以上代码只能修改body里的样式 而对@media print 里的属性无效请教各位高手达人啊,小弟谢谢了~
@media print{ BODY {display:none}} /* 防打印 */
</style> 作用是,使页面不能被打印。现在我要加一个按钮,只有在点击的时候才能够打印页面。
现在的主要问题是不知道这段js应该怎么写,才能够修改 @media print 里的打印属性
页面的代码如下<style >
@media print{ BODY {display:none}} /* 防打印 */
</style> <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0>
</OBJECT><input type="button" value="打印" onclick ="document.body.style.cssText='color:red';wb.execwb(6,1)">以上代码只能修改body里的样式 而对@media print 里的属性无效请教各位高手达人啊,小弟谢谢了~
解决方案 »
- 两层iframe赋值,是这样吗?
- 同一段脚本代码,IE6运行正常,IE8就不正常了,谷歌浏览器也不正常
- 【正则表达式】一个字符串中不包含某个字符串
- 页面停留问题
- js统计点击按钮次数的效果,在后台页面显示次数
- 关于编写javascript访问目标网页内容的问题
- 如何捕获popup消失时的事件?我想在popup窗口消失后作点处理,有没有这样的事件?
- 基础问题!!!
- 输出"object HTMLSelectElement" 怎么才能把数据的DOM列出来?
- 制作一个有计算功能的网页问卷,小白求帮助!!!
- extjs 监听事件问题
- exjs3 grid中有些数据行需要checkbox,有些数据行不需要checkbox,请问怎么实现啊???????????????????????
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css" media="print" id="style1" >
BODY{display:none} /* 防打印 */
</style>
</head><body>
打印内容...
...<input type="button" value="打印" onclick="allowPrint();" />
<script type="text/javascript">
function allowPrint(){
var style = document.getElementById('style1');
style.media = "none";
window.print();
}
</script>
</body>
</html>
@media screen {
.input1 {display:none}
.input2 {}
}
@media print {
.input1 {}
.input2 {display:none}
}
</style>
……
<body>
<input class="input1" type="submit" value="打印" id=submit1 name=submit1 >
<input class="input2" type="submit" value="不打印,但可以看" id=submit1 name=submit1 >
……
</body>
BODY{display:none} /* 防打印 */
</style>
如果 这个样式中 还有 table 样式,那么 要是 执行 style.media = "none";
之后 table 的样式怎么办呢 ?