doc2html asp,ASP常见问题及解答(3)-ASP教程,ASP技巧
1.图片显示控制:
var flag=false;
function drawimage(imgd){
var image=new image();
image.src=imgd.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= 360/270){
if(image.width>360){
imgd.width=360;
imgd.height=(image.height*360)/image.width;
}else{
imgd.width=image.width;
imgd.height=image.height;
}
imgd.alt=image.width+"×"+image.height;
}
else{
if(image.height>270){
imgd.height=270;
imgd.width=(image.width*270)/image.height;
}else{
imgd.width=image.width;
imgd.height=image.height;
}
imgd.alt=image.width+"×"+image.height;
}
}
}
//–>
调用格式:
2.用asp把doc转换成html
doc2html.vbs
**********************************************************
调用方法:doc2html c:\doc2html c:\doc2html
调用方法:doc2html -s c:\doc2html\a.doc c:\doc2html
**********************************************************
dim objword
dim objdoc
dim objfso
dim strsource
dim strtarget
dim bbatch
得到命令行参数,有三种可能的格式:[-s] 要进行转换的源文件目录或文件 转换成html文件后保存的目录
function getparams()
dim objarg
if wscript.arguments.count >= 2 then
if wscript.arguments.item(0) = "-s" or wscript.arguments.item(0) = "-s" then
strsource = wscript.arguments.item(1)
strtarget = wscript.arguments.item(2)
bbatch = false
else
strsource = wscript.arguments.item(0)
strtarget = wscript.arguments.item(1)
bbatch = true
end if
else
wscript.quit(1)
end if
end function
function batchprocessing()
dim objfolder
dim objfile
dim lpos
dim strfilename
lpos = 0
set objfolder = objfso.getfolder(strsource)
for each objfile in objfolder.files
lpos = instr(1,mid(objfile.path,len(objfile.path) – 3,4),"doc",1)
if lpos > 0 then
strfilename = objfso.getbasename(objfile.path)
wordinterface objfile.path,strfilename
end if
next
end function
function singleprocessing()
dim objfile
set objfile = objfso.getfile(strsource)
strfilename = objfso.getbasename(objfile.path)
wordinterface objfile.path,strfilename
end function
function wordinterface(strfilename,formattedfilename)
objword.documents.open strfilename
set objdoc = objword.activedocument
stop
set the title of the document to match the filename
objdoc.builtindocumentproperties(1) = formattedfilename
1 = wdpropertytitle in vba
objdoc.saveas strtarget & "\" & formattedfilename & ".htm",8
objdoc.saveas "c:\doc2html\" & formattedfilename & ".htm",8
on error resume next
objdoc.close
end function
stop
set objfso = createobject("scripting.filesystemobject")
set objword = createobject("word.application")
objword.visible = false
call getparams
if bbatch then
call batchprocessing
else
call singleprocessing
end if
objword.quit
set objword = nothing
3.自己写的将小写金额换成大写
****人民币大小写转换格式****
dim str(9)
str(0)="零"
str(1)="壹"
str(2)="贰"
str(3)="叁"
str(4)="肆"
str(5)="伍"
str(6)="陆"
str(7)="柒"
str(8)="捌"
str(9)="玖"
aa=request.form("source")
hh=formatnumber(aa,2,-1)
aa=replace(hh,".","")
aa=replace(aa,",","")
for i=1 to len(aa)
s=mid(aa,i,1)
mynum=str(s)
select case(len(aa)+1-i)
case 1: k= mynum&"分"
case 2: k= mynum&"角"
case 3: k= mynum&"元"
case 4: k= mynum&"拾"
case 5: k= mynum&"佰"
case 6: k= mynum&"仟"
case 7: k= mynum&"万"
case 8: k= mynum&"拾"
case 9: k= mynum&"佰"
case 10: k= mynum&"仟"
end select
m=m&k
next
%>
数字转换
elseif(s=".") then
n=m
i=i+2
for j=i to len(aa)
s=mid(aa,i,1)
mynum=str(s)
select case(len(aa)+1-i)
case 1: p= mynum&"分"
case 2: p= mynum&"角"
end select
m=m&p
next
–>
=
4.获取中文字符串拼音首字母串的函数
response.write ""
if request.form("content")="" then
response.write "
__"
else
function getpychar(char)
tmp=65536+asc(char)
if(tmp>=45217 and tmp<=45252) then
getpychar= "a"
elseif(tmp>=45253 and tmp<=45760) then
getpychar= "b"
elseif(tmp>=45761 and tmp<=46317) then
getpychar= "c"
elseif(tmp>=46318 and tmp<=46825) then
getpychar= "d"
elseif(tmp>=46826 and tmp<=47009) then
getpychar= "e"
elseif(tmp>=47010 and tmp<=47296) then
getpychar= "f"
elseif(tmp>=47297 and tmp<=47613) then
getpychar= "g"
elseif(tmp>=47614 and tmp<=48118) then
getpychar= "h"
elseif(tmp>=48119 and tmp<=49061) then
getpychar= "j"
elseif(tmp>=49062 and tmp<=49323) then
getpychar= "k"
elseif(tmp>=49324 and tmp<=49895) then
getpychar= "l"
elseif(tmp>=49896 and tmp<=50370) then
getpychar= "m"
elseif(tmp>=50371 and tmp<=50613) then
getpychar= "n"
elseif(tmp>=50614 and tmp<=50621) then
getpychar= "o"
elseif(tmp>=50622 and tmp<=50905) then
getpychar= "p"
elseif(tmp>=50906 and tmp<=51386) then
getpychar= "q"
elseif(tmp>=51387 and tmp<=51445) then
getpychar= "r"
elseif(tmp>=51446 and tmp<=52217) then
getpychar= "s"
elseif(tmp>=52218 and tmp<=52697) then
getpychar= "t"
elseif(tmp>=52698 and tmp<=52979) then
getpychar= "w"
elseif(tmp>=52980 and tmp<=53640) then
getpychar= "x"
elseif(tmp>=53689 and tmp<=54480) then
getpychar= "y"
elseif(tmp>=54481 and tmp<=62289) then
getpychar= "z"
else 如果不是中文,则不处理
getpychar=char
end if
end function
function getpy(str)
for i=1 to len(str)
getpy=getpy&getpychar(mid(str,i,1))
next
end function
content=request.form("content")
response.write "
"&getpy(content)&chr(10)
response.write "返回"
end if
%>
5.ip限制函数
******************************
function checkip(cinput_ip,cbound_ip)
created by qqdao, qqdao@263.net 2001/11/28
说明:首先需要根据;号循环,然后判断是否含有"-",如果有则进行拆分处理,最后判断是否在范围内
参数: cinput_ip,代检查的ip
cbound_ip,给定的范围格式为,单个ip,和范围ip,范围ip最后使用”-“分割,如果是“*”则必须放到最后一位
每个范围后添加":allow"表示允许登陆,添加":refuse"表示拒绝登陆。多个范围用”;“隔开
例如192.168.1*.*:allow;192.168.1.1:allow;192.168.1.1-10:refuse"
返回值: true/false
更新:2001/12/05 支持allow,refuse支持’*‘,不想对?支持,因为和*差不多
******************************
function checkip(cinput_ip,cbound_ip)
dim csingle_ip,ctemp_ip,cstart_ip,cend_ip
checkip = false
csingle_ip=split(cbound_ip,";")
for i=0 to ubound(csingle_ip)
if instr(csingle_ip(i),"refuse") <> 0 then 就是拒绝了
ctemp_ip = left(csingle_ip(i),instr(csingle_ip(i),":")-1)
if instr(ctemp_ip,"*") <> 0 then 是宽范围
cstart_ip = left(ctemp_ip,instr(ctemp_ip,"*")-1)
if left(cinput_ip,len(cstart_ip))=cstart_ip then
checkip = false
exit function
end if
end if
if instr(ctemp_ip,"-") = 0 then
cstart_ip = ctemp_ip
cend_ip = ctemp_ip
else
cstart_ip = left(ctemp_ip,instr(ctemp_ip,"-")-1)
cend_ip = left(cstart_ip,instrrev(cstart_ip,".")-1)+"."+mid(ctemp_ip,instr(ctemp_ip,"-")+1)
end if
if ip2str(cinput_ip)>=ip2str(cstart_ip) and ip2str(cinput_ip)<=ip2str(cend_ip) then
checkip = false
exit function
end if
elseif instr(csingle_ip(i),"allow") <> 0 then 允许
ctemp_ip = left(csingle_ip(i),instr(csingle_ip(i),":")-1)
if instr(ctemp_ip,"*") <> 0 then 是宽范围
cstart_ip = left(ctemp_ip,instr(ctemp_ip,"*")-1)
if left(cinput_ip,len(cstart_ip))=cstart_ip then
checkip = true
end if
end if
if instr(ctemp_ip,"-") = 0 then
cstart_ip = ctemp_ip
cend_ip = ctemp_ip
else
cstart_ip = left(ctemp_ip,instr(ctemp_ip,"-")-1)
cend_ip = left(cstart_ip,instrrev(cstart_ip,".")-1)+"."+mid(ctemp_ip,instr(ctemp_ip,"-")+1)
end if
if ip2str(cinput_ip)>=ip2str(cstart_ip) and ip2str(cinput_ip)<=ip2str(cend_ip) then
checkip =true
else
checkip =false
end if
end if
next
end function
doc2html asp,ASP常见问题及解答(3)-ASP教程,ASP技巧相关推荐
- 用aspx开发html5页面,ASP.NET使aspx页面能接受HTML,asp的页面传送的文件-.NET教程,Asp.Net开发...
aspx接受aspx页面的文件很简单,用htmlinputfile,就可以了,但是如果接受html页面post的文件 就不怎么好办了,我仿照asp的方法做法如下,自己测试通过,拿出来给大家共享,可以限 ...
- 《ASP.NET AJAX程序设计 第I卷 服务器端ASP.NET AJAX Extensions与ASP.NET AJAX Control Toolkit》目录(最终定稿)...
第一二卷都比较简单,特别是第一卷,讲的都是服务器端控件.第二卷是客户端部分,第三卷是高级内容,包括调试.性能.部署.控件开发.源代码结构.用户体验.心理学模型等等-- 第一卷争取在四月份出版,谢谢各位 ...
- php更改asp.net教程,ASP.NET 教程
ASP.NET 是一个使用 HTML.CSS.JavaScript 和服务器脚本创建网页和网站的开发框架. ASP.NET 支持三种不同的开发模式: Web Pages(Web 页面).MVC(Mod ...
- asp.NET自定义服务器控件内部细节系列教程四
如大家要转载,请保留本人的版权: /* *Description:asp.NET自定义服务器控件内部细节系列教程 *Auther:崇崇-天真的好蓝 *MSN:chongchong2008@msn.co ...
- ASP.NET Web API实践系列06, 在ASP.NET MVC 4 基础上增加使用ASP.NET WEB API
本篇尝试在现有的ASP.NET MVC 4 项目上增加使用ASP.NET Web API. 新建项目,选择"ASP.NET MVC 4 Web应用程序". 选择"基本&q ...
- ASP .NET Core Web Razor Pages系列教程四:使用数据库进行交互 entity-framework(MySQL/MariaDB 版)
系列文章目录:系列教程:使用ASP.NET Core创建Razor Pages Web应用程序 - zhangpeterx的博客 系列教程代码的GitHub地址:ASP .Net Core Razor ...
- ASP.NET Core Web Razor Pages系列教程八: 添加验证
系列文章目录:系列教程:使用ASP.NET Core创建Razor Pages Web应用程序 - zhangpeterx的博客 系列教程代码的GitHub地址:ASP .Net Core Razor ...
- ASP.NET Core Web Razor Pages系列教程七: 添加新的字段
系列文章目录:系列教程:使用ASP.NET Core创建Razor Pages Web应用程序 - zhangpeterx的博客 系列教程代码的GitHub地址:ASP .Net Core Razor ...
- ASP.NET Core Web Razor Pages系列教程六:添加搜索功能
系列文章目录:系列教程:使用ASP.NET Core创建Razor Pages Web应用程序 - zhangpeterx的博客 系列教程代码的GitHub地址:ASP .Net Core Razor ...
- ASP .NET Core Web Razor Pages系列教程五:更新Razor Pages页面
系列文章目录:系列教程:使用ASP.NET Core创建Razor Pages Web应用程序 - zhangpeterx的博客 系列教程代码的GitHub地址:ASP .Net Core Razor ...
最新文章
- IIS6、7添加反向代理的步骤
- HTML的br/标签和hr/标签
- CodeForces - 1516D Cut(思维+倍增)
- 软件构造学习笔记-第十四周、十五周
- C language day1
- 【Python3网络爬虫开发实战】1.5.1-PyMySQL的安装
- lenovo X230热键功能
- mysql慢查询ep_mysql 慢查询分析
- 在函数‘_start’中:对‘main’未定义的引用
- 树莓派安装vsftp过程中遇到的坑
- 联想T110 8G优盘 安国AU6983主控量产成功
- Origin绘制图表所需要的步骤
- Python爬虫:爬取必应壁纸(可直接运行)
- Android自定义view半圆形错误提示框和简单动画使用
- win10 nginx安装和使用
- H264马赛克、延时的优化
- python 将列表中的英文或者拼音转换为中文
- 北风python培训
- vacuum 数据库 用法_postgresql vacuum操作
- python 运算符与表达式
热门文章
- 基于JAVA+SpringMVC+MYSQL的网上选课系统
- 基于JAVA+SpringMVC+MYSQL的大学毕业生就业信息管理系统
- 基于JAVA+SpringMVC+Mybatis+MYSQL的网上二手车交易系统
- android多个activity共用一个菜单,Android开发之多个Activity跳转(Intent)及菜单用法(menu)...
- 循环结构c语言乘电梯,C语言循环结构练习题.doc
- Java学习笔记24(Map集合)
- Linux 进程间通信 - 信号量
- Android程序员视角的Apple发布会
- Mysql字符串组合的问题
- .DateTimeToStr函数专用优化版