选择显示字体大小

asp实用函数库

<%
'判断文件名是否合法
function isfilename(afilename)
 dim serrorstr,inamelength,i
 isfilename=true
 serrorstr=array("/","\",":","*","?","""","<",">","")
 inamelength=len(afilename)
 if inamelength<1 or inamelength=null then
  isfilename=false
 else
  for i=0 to 8
   if instr(afilename,serrorstr(i)) then
    isfilename=false   
   end if
  next
 end if
end function

'去掉字符串头尾的连续的回车和空格
function trimvbcrlf(str)
 trimvbcrlf=rtrimvbcrlf(ltrimvbcrlf(str))
end function

'去掉字符串开头的连续的回车和空格
function ltrimvbcrlf(str)
 dim pos,isblankchar
 pos=1
 isblankchar=true
 while isblankchar
  if mid(str,pos,1)=" " then
   pos=pos+1
  elseif mid(str,pos,2)=vbcrlf then
   pos=pos+2
  else
   isblankchar=false
  end if
 wend
 ltrimvbcrlf=right(str,len(str)-pos+1)
end function

'去掉字符串末尾的连续的回车和空格
function rtrimvbcrlf(str)
 dim pos,isblankchar
 pos=len(str)
 isblankchar=true
 while isblankchar and pos>=2
  if mid(str,pos,1)=" " then
   pos=pos-1
  elseif mid(str,pos-1,2)=vbcrlf then
   pos=pos-2
  else
   isblankchar=false
  end if
 wend
 rtrimvbcrlf=rtrim(left(str,pos))
end function

'判断email是否有效,返回1表示正确
function isemail(aemail)
 dim ilocat,v,ilength,i,checkletter
 if instr(aemail,"@") = 0 or instr(aemail,".") = 0 then
  isemail=0
  exit function
 end if
 ilocat=instr(aemail,"@")
 if instr(ilocat,aemail,".")=0 or instr(ilocat+1,aemail,"@")>0 then
  isemail=0
  exit function
 end if
 if left(aemail,1)="." or right(aemail,1)="." or left(aemail,1)="@" or right(aemail,1)="@" then
  isemail=0
  exit function
 end if
 v="1234567890abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz_-.@"
 ilength=len(aemail)
 for i=1 to ilength
  checkletter=mid(aemail,i,1)
  if instr(v,checkletter)=0 then
   isemail=0
   exit function
  end if
 next
 isemail=1
end function

'测试用:显示服务器信息
sub showserver
 dim name
 response.write "<table border=1 bordercolor=lightblue cellspacing=0>"
 for each name in request.servervariables
  response.write "<tr>"
  response.write "<td>"&name&"</td>"
  response.write "<td>"&request.servervariables(name)&"<br></td>"
  response.write "</tr>"
 next
 response.write "</table>"
end sub

'测试用:显示rs结果集以及字段名称
sub showrs(rs)
 dim strtable,whatever
 response.write "<center><table><tr>"
 for each whatever in rs.fields
  response.write "<td><b>" & whatever.name & "</b></td>"
 next
 strtable = "</tr><tr><td>"&rs.getstring(,,"</td><td>","</tr><tr><td>"," ") &"</td></tr></table></center>"
 response.write(strtable)
end sub

'用html格式显示文本
function htmlencode(fstring)
if not isnull(fstring) then
    fstring = replace(fstring, ">", "&gt;")
    fstring = replace(fstring, "<", "&lt;")

    fstring = replace(fstring, chr(32), "&nbsp;")
    fstring = replace(fstring, chr(34), "&quot;")
    fstring = replace(fstring, chr(39), "&#39;")
    fstring = replace(fstring, chr(13), "")
    fstring = replace(fstring, chr(10) & chr(10), "</p><p> ")
    fstring = replace(fstring, chr(10), "<br> ")
    htmlencode = fstring
end if
end function

'测试用:显示调试错误信息
sub showerror
 dim serrmsg
 serrmsg=err.source&" "&err.description
 response.write "<center>"&serrmsg&"</center>"
 err.clear
end sub

'显示文字计数器
sub showcounter
dim fs,outfile,filename,count
filename=server.mappath("count.txt")
set fs = createobject("scripting.filesystemobject")
if fs.fileexists(filename) then
 set outfile=fs.opentextfile(filename,1)
 count=outfile.readline
 count=count+1
 response.write "<center>浏览人次:"&count&"<center>"
 outfile.close
 set outfile=fs.createtextfile(filename)
 outfile.writeline(count)
else
 set outfile=fs.opentextfile(filename,8,true)
 count=0
 outfile.writeline(count)
end if
outfile.close
set fs=nothing
end sub
%>

本新闻共10


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons