Ⅰ 如何为ASP网页设置页脚
你所说的这个是javaSCRIPT的方面,ASP不涉汲到打印控制,
还有JAVASCRIPT的打印是可控的.比如控制纸张大小,边距,页眉页脚等都可以
以下代码是打印控制
1、控制"纵打"、 横打”和“页面的边距。
(1)<script defer>
function SetPrintSettings() {
// -- advanced features
factory.printing.SetMarginMeasure(2) // measure margins in inches
factory.SetPageRange(false, 1, 3) // need pages from 1 to 3
factory.printing.printer = "HP DeskJet 870C"
factory.printing.copies = 2
factory.printing.collate = true
factory.printing.paperSize = "A4"
factory.printing.paperSource = "Manual feed"
// -- basic features
factory.printing.header = "This is MeadCo"
factory.printing.footer = "Advanced Printing by ScriptX"
factory.printing.portrait = false
factory.printing.leftMargin = 1.0
factory.printing.topMargin = 1.0
factory.printing.rightMargin = 1.0
factory.printing.bottomMargin = 1.0
}
</script>
(2)
<script language="javascript">
function printsetup(){
// 打印页面设置
wb.execwb(8,1);
}
function printpreview(){
// 打印页面预览
wb.execwb(7,1);
}
function printit()
{
if (confirm('确定打印吗?')) {
wb.execwb(6,6)
}
}
</script>
</head>
<body>
<OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
height=0 id=wb name=wb width=0></OBJECT>
<input type=button name=button_print value="打印"
onclick="javascript:printit()">
<input type=button name=button_setup value="打印页面设置"
onclick="javascript:printsetup();">
<input type=button name=button_show value="打印预览"
onclick="javascript:printpreview();">
<input type=button name=button_fh value="关闭"
onclick="javascript:window.close();">
------------------------------------------------
关于这个组件还有其他的用法,列举如下:
WebBrowser.ExecWB(1,1) 打开
Web.ExecWB(2,1) 关闭现在所有的IE窗口,并打开一个新窗口
Web.ExecWB(4,1) 保存网页
Web.ExecWB(6,1) 打印
Web.ExecWB(7,1) 打印预览
Web.ExecWB(8,1) 打印页培高面配亩尺设置
Web.ExecWB(10,1) 查看页耐孙面属性
Web.ExecWB(15,1) 好像是撤销,有待确认
Web.ExecWB(17,1) 全选
Web.ExecWB(22,1) 刷新
Web.ExecWB(45,1) 关闭窗体无提示
2、分页打印
<HTML>
<HEAD>
<STYLE>
P {page-break-after: always}
</STYLE>
</HEAD>
<BODY>
<%while not rs.eof%>
<P><%=rs(0)%></P>
<%rs.movenext%>
<%wend%>
</BODY>
</HTML>
3、ASP页面打印时如何去掉页面底部的路径和顶端的页码编号
(1)ie的文件-〉页面设置-〉讲里面的页眉和页脚里面的东西都去掉,打印就不出来了。
(2)<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="YC">
<script language="VBScript">
dim hkey_root,hkey_path,hkey_key
hkey_root="HKEY_CURRENT_USER"
hkey_path="\Software\Microsoft\Internet Explorer\PageSetup"
'//设置网页打印的页眉页脚为空
function pagesetup_null()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""
end function
'//设置网页打印的页眉页脚为默认值
function pagesetup_default()
on error resume next
Set RegWsh = CreateObject("WScript.Shell")
hkey_key="\header"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b页码,&p/&P"
hkey_key="\footer"
RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d"
end function
</script>
</HEAD>
<BODY>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/><p align=center>
<input type="button" value="清空页码" onclick=pagesetup_null()> <input type="button" value="恢复页吗" onclick=pagesetup_default()><br/>
</p>
</BODY>
</HTML>
4、浮动帧打印
<SCRIPT LANGUAGE=javascript>
function button1_onclick() {
var odoc=window.iframe1.document;
var r=odoc.body.createTextRange();
var stxt=r.htmlText;
alert(stxt)
var pwin=window.open("","print");
pwin.document.write(stxt);
pwin.print();
}
</SCRIPT>
4、用FileSystem组件实现WEB应用中的本地特定打印
<script Language=VBScript>
function print_onclick //打印函数
dim label
label=document.printinfo.label.value //获得HTML页面的数据
set objfs=CreateObject("Scripting.FileSystemObject") //创建FileSystem组件对象的实例
set objprinter=objfs.CreateTextFile ("LPT1:",true) //建立与打印机的连接
objprinter.Writeline("__________________________________") //输出打印的内容
objprinter.Writeline("| |")
objprinter.Writeline("| 您打印的数据是:"&label& " |”)
objprinter.Writeline("| |")
objprinter.Writeline("|_________________________________|")
objprinter.close //断开与打印机的连接
set objprinter=nothing
set objfs=nothing // 关闭FileSystem组件对象
end function
</script>
服务器端脚本:
<%………
set conn=server.CreateObject ("adodb.connection")
conn.Open "DSN=name;UID=XXXX;PWD=XXXX;"
set rs=server.CreateObject("adodb.recordset")
rs.Open(“select ……”),conn,1,1
……….%> //与数据库进行交互
HTML页面编码:
<HTML>
………
<FORM ID=printinfo NAME="printinfo" >
<INPUT type="button" value="打印>>" id=print name=print > //调用打印函数
<INPUT type=hidden id=text1 name=label value=<%=………%>> //保存服务器端传来的数据
………
</HTML>
Ⅱ html怎么添加页眉页脚
首先我们来介绍一下@page的相关用法磨配册:
@page用于设置页面容器的版式,方向,边空等。
语法:
@page<label> <pseudo-classes>{ sRules }
取值:
<label>:
页面标识符
<pseudo-class>:
打印伪类:first,:left,:right
在Firefox,Safari,Internet Explorer,Google Chrome,Opera等浏览器中,默认的页眉是网页title,页脚是第几页/共几页. 只有Microsoft Edge没有默认的页眉,页脚,为了样式统一,我们可以在打印时关闭浏览器自带页眉页脚,统一使用CSS定义的页眉页脚
接下来,我们在网页中定义专用于打印的CSS样式,在style标签中使用media="print"进行定义,如下
<style type="text/css" media="print">
接下来为每一页设置页边距
@page {margin-left: 50px; margin-top: 100px;}
如果有封面,可以用以下样式单独定义
@page :first {
margin-left: 50%;
margin-top: 50%;
}
具体样式可根据自己需要写入样式内
接下来再定义几个样式用于分页及页眉页脚
这是分页标记的样式
.geovin{
page-break-after: always;
}
这是页眉的样式
.pageheader {
margin-top: 10px;
font-size:12pt;
}
具体样式可根据自己需要写入样式内
这是页眉的样式
.pagefooter{
margin-top: 10px;
font-size:10pt;
}
具体样式可根据自己需要写入样式内
接下来在body标签内输入相关html标签并应用我们的样式
<body>
<script type="text/javascript">
document.querySelector("button").onclick = function () {
window.print();
}
</script>
<div id="geovin" class="geovin">
<div class="pageheader">瞎宏页眉:打印测试</div>
<div class="conent">
封面内容
</div>
<div class="pagefooter">页脚:第1页/共2页</div>
</div>
<div id="geovin" class="geovin">
<div class="pageheader">页眉:打印测试</div>
<div class="conent">
第二页内容
</div>
<div class="pagefooter">页脚:第2页/共2页</div>
</div>
<button>打印按钮</button>卖滚
</body>
以上仅做为参考,可以根据自己的需要灵活使用
最后贴上完整html,大家可以复制到文本编辑中保存网页来测试
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>打印测试页</title>
<style type="text/css" media="screen">
.pageheader ,.pagefooter {display:none;}
</style>
<style type="text/css" media="print">
/*每一页 如果没有另外自定义的话 */
@page {margin-left: 50px; margin-top: 100px;}
/*第一页*/
@page :first {
margin-left: 50%;
margin-top: 50%;
}
/*分页标记*/
.geovin{
page-break-after: always;
}
.pageheader {
margin-top: 10px;
font-size:12pt;
}
.pagefooter{
margin-top: 10px;
font-size:10pt;
}
</style>
</head>
<body>
<script type="text/javascript">
document.querySelector("button").onclick = function () {
window.print();
}
</script>
<div id="geovin" class="geovin">
<div class="pageheader">页眉:打印测试</div>
<div class="conent">
封面内容
</div>
<div class="pagefooter">页脚:第1页/共2页</div>
</div>
<div id="geovin" class="geovin">
<div class="pageheader">页眉:打印测试</div>
<div class="conent">
第二页内容
</div>
<div class="pagefooter">页脚:第2页/共2页</div>
</div>
<button>打印按钮</button>
</body>
</html>
Ⅲ 网页页眉页脚怎么设置
问题一:如何设置网页中页眉和页脚的打印效果 IE浏览器-菜单:文件――页面设置- 页眉 的参数是:&w&b页码,&p/&P 页脚 的参数是:&u&b&d 设置好了的话,就可以了
问题二:word中如何设置页眉页脚至所有页面 视图下 找页眉页脚
问题三:浏览器怎么设置页眉 没听说过游览器可以设置页眉的,好象可以设置打印时要不要打印页眉,我也跟踪一下,有答案也告鸡我一下啊。
问题四:如何设置word页眉页脚内页码? 双击页眉,将之前的信息删除掉,选择自动图文集,选择第X页 共Y页,关闭,需要居中的话,再双击页础,手动选择右上的居中按钮即可
问题五:word如何将多页的页眉页脚设置成和首页一样的 如果你已经设置了页眉页脚,就菜单-页面设置-版式-取消首页不同的勾。
如果没有设盯页眉页脚,就在视或森图-页眉页脚重新设置一下页眉页脚就行啦!!
问题六:wps怎么设置全部页面的页眉页脚页边距和行距? 插入页码里面设页眉页脚,行距在段落里面设置。
问题七:页眉页脚怎么设置会使页与页之间不一样? 要利用插入菜单 分隔符 下面的分节符
问题八:如何在word的页面左侧或右侧设置页眉迹团搏、页脚? 页眉、页脚无法设置在左侧或右侧,你只能使用文本框等技巧。
问题九:360安全浏览器6版本 怎么设置打印页眉页脚 5分 1、打开360浏览器(6.2版本)顶部右侧文件”选项“――”打印“,或直接按下ctrl+p;如图所示:
2、进入网页打印预览页面后,点击查看全视角按钮,以方便预览整个效果,或直接按下alt+w;如图所示:
3、发现网页打印预览中网页的页眉和页脚部分均有一些我们不需要的信息,如页码、网页URL等;如图所示:
4、点击网页预览姿祥页面的页面设置按钮,或者直接按下alt+u;如图所示:
5、进入页面设置后,将页眉和页脚下的所选项设置成空,并对修改内容进行确定;如图所示:
6、对页面设置的修改进行确定后,网页将会重新加载预览页面,这时会发现讨论的页眉和页脚不见了,如图所示:
Ⅳ 制作网页时网页的页脚怎么设置
一般写栏目或者版权。