html怎么打印

html怎么打印,第1张

需要准备的材料分别有:电脑、chrome浏览器、打印机。

1、首先,打开想要打印的html网页,例如:zhidao.baidu.com。

2、在网页中,鼠标右键空白处,点击打印按钮

3、此时会d出打印面板,点击“打印”按钮即可完成打印。

<html><head><title>打印-页面设置-打印预览-关闭窗口</title>

<script language=javascript>

function printsetup()

{

// 打印页面设置

wb.execwb(8,1)

}

function printpreview()

{

var ht1 = document.getElementByIdx_x("h")

ht1.style.display="none"//隐藏不必打印的部分,该隐藏只在预览中有效,真正打印时要用css控制

wb.execwb(7,1)// 打印页面预览

ht1.style.display="" //预览完再将隐藏的部分显示出来

}

function printit()

{

 if (confirm('确定打印吗?'))

{

wb.execwb(6,6)

}

}

</script>

<style type="text/css" media=print>

.noprint{display : none } //不打印

</style>

</head>

<body>

<!-- div h 中的内容不打印 -->

<div id="h" align=center class="noprint">

<OBJECT id=wb height=0 width=0 classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT>

<INPUT onclick=javascript:printit() type=button value=打印 />

<INPUT onclick=javascript:printsetup()type=button value=打印页面设置 />

<INPUT onclick=javascript:printpreview()type=button value=打印预览 />

<INPUT onclick=javascript:window.close()type=button value=关闭 />

</div>

要打印的正文

</body>

</html>

我也是菜鸟   用jq写了下这个效果  献丑了

                <input type="text" name="" id="oneinput" value="" />

<button id="twoinput">添加</button>

<ul class="list">

</ul>

<script src="js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">

$(document).ready(function() {

$("#twoinput").click(function() {

one = $('#oneinput').val()

$(".list").append("<li>" + one + "</li>")

})

})

</script>

<style type="text/css">

ul li:nth-child(3n) {

color: red

}

/*控制样式  每个三个 颜色为红色*/

</style>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7074113.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-01
下一篇 2023-04-01

发表评论

登录后才能评论

评论列表(0条)

保存