感冒咳嗽挂什么科室:ASP技巧集锦1

来源:百度文库 编辑:偶看新闻 时间:2024/05/01 14:26:28

1.如何 最小化、最大化、关闭窗口
答:

1.如何 最小化、最大化、关闭窗口
答:






2.如何静止页面缓存
答:htm网页



或者
asp网页
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
php网页
header("expires:mon,26jul199705:00:00gmt");
header("cache-control:no-cache,must-revalidate");
header("pragma:no-cache");

3.如何检查一段字符串是否全由数字组成

4.如何获取机器信息
答本机ip<%=request.servervariables("remote_addr")%>
服务器名<%=request.servervariables("server_name")%>
服务器ip<%=request.servervariables("local_addr")%>
服务器端口<%=request.servervariables("server_port")%>
服务器时间<%=now%>
iis版本<%=request.servervariables"server_software")%>
脚本超时时间<%=server.scripttimeout%>
本文件路径<%=server.mappath(request.servervariables("script_name"))%>
服务器cpu数量<%=request.servervariables("number_of_processors")%>
服务器解译引擎<%=scriptengine&"/" & scriptenginemajorversion &"." & scriptengineminorversion & "." & scriptenginebuildversion%>
服务器操作系统<%=request.servervariables("os")%>1.如何让日期相减
日期减去天数等于第二个日期

functioncc(dd,dadd)
{
file://可以加上错误处理
vard=newdate(dd.replace("-","/"))
d.setdate(d.getdate()+dadd)
alert(d.getfullyear()+"年"+(d.getmonth()+1)+"月"+d.getdate()+"日")
}
cc("2002-2-28",2)


1.怎样通过asp的手段来检查来访者是否用了代理
<%ifrequest.servervariables("http_x_forwarded_for")<>""then
response.write"您通过了代理服务器,"&_
"真实的ip为"&request.servervariables("http_x_forwarded_for")
endif
%>


获得窗口的大小
document.body.clientWidth,document.body.clientHeight
document.body.offsetWidth,document.body.offsetHeight

判断一个表是否存在:
if exists (select * from dbo.sysobjects where id = object_id(‘表名‘) and OBJECTPROPERTY(id, N‘IsUserTable‘) = 1)
drop table 表名
GO
从publish 表中取出第 n 条到第 m 条的记录:
SELECT TOP m-n+1 *
FROM publish
WHERE (id NOT IN
      (SELECT TOP n-1 id
     FROM publish))

id 为publish 表的关键字


分类: js程序

1.如何实现连续滚动



数据里面读出来的


 

只针对图片:





 

1. oncontextmenu="window.event.returnvalue=false" 将彻底屏蔽鼠标右键

no
可用于Table

2. 取消选取、防止复制

3. onpaste="return false" 不准粘贴

4. oncopy="return false;" oncut="return false;" 防止复制

5. IE地址栏前换成自己的图标

6. 可以在收藏夹中显示出你的图标

7. 关闭输入法

8. 永远都会带着框架

9. 防止被人frame

10. 网页将不能被另存为

11. onclick="window.location = ‘view-source:‘+ ‘http://www.csdn.net/‘">

12. 怎样通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>

13. 取得控件的绝对位置

file://javascript

file://VBScript

14. 光标是停在文本框文字的最后

15. 判断上一页的来源
asp:
request.servervariables("HTTP_REFERER")

javascript:
document.referrer

 

图片显示控制:

 

调用格式:

用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


<%
‘****人民币大小写转换格式****
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
%>




数字转换





=




‘获取中文字符串拼音首字母串的函数
<%
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
%>


--------------------------------------------
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


取当前网页的地址全名,以便返回用
<%
Function GetUrl()
On Error Resume Next
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
strTemp = strTemp & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then strTemp = strTemp & "?" & Trim(Request.QueryString)
GetUrl = strTemp
End Function
‘Response.write GetUrl()
url1=GetUrl()
url1=Server.URLEncode(url1)

%>

 

上传文件时,显示进度条程序

在需要引用进度条的也面上用

然后,

传参数 true

ShowProcessBar.js
—————————————————————————————————————————
AddProcessbar();
var bwidth=0;
var swidth = document.all.waiting.clientWidth;

function CheckIsProcessBar(obj)
{
if (obj.IsShowProcessBar=="True")
{
return false;
}
else
{
return true;
}
}

function CheckClick(e)
{
if (e == 1)
{
if (bwidthbwidth += (swidth - bwidth) * 0.025;
if (document.all)document.sbar.width = bwidth;
else document.rating.clip.width = bwidth;
setTimeout(‘CheckClick(1);‘,1000);

}
}
else
{
if(document.all)
{
if(document.all.waiting.style.visibility == ‘visible‘)
{document.all.waiting.style.visibility = ‘hidden‘;
bwidth = 1;}
whichIt = event.srcElement;

while (CheckIsProcessBar(whichIt))
{
whichIt = whichIt.parentElement;
if (whichIt == null)return true;
}


document.all.waiting.style.pixelTop = (document.body.offsetHeight - document.all.waiting.clientHeight) / 2 + document.body.scrollTop;
document.all.waiting.style.pixelLeft = (document.body.offsetWidth - document.all.waiting.clientWidth) / 2 + document.body.scrollLeft;
document.all.waiting.style.visibility = ‘visible‘;
if(!bwidth)CheckClick(1);
bwidth = 1;

}

else
{

if(document.waiting.visibility == ‘show‘)
{document.waiting.visibility = ‘hide‘;
document.rating.visibility = ‘hide‘;
bwidth = 1;}
if(e.target.href.toString() != ‘‘)
{
document.waiting.top = (window.innerHeight - document.waiting.clip.height) / 2 + self.pageYOffset;
document.waiting.left = (window.innerWidth - document.waiting.clip.width) / 2 + self.pageXOffset;
document.waiting.visibility = ‘show‘;
document.rating.top = (window.innerHeight - document.waiting.clip.height) / 2 + self.pageYOffset+document.waiting.clip.height-10;
document.rating.left = (window.innerWidth - document.waiting.clip.width) / 2 + self.pageXOffset;
document.rating.visibility = ‘show‘;
if(!bwidth)CheckClick(1);
bwidth = 1;
}
}
return true;
}
}

function AddProcessbar()
{

var Str=""
Str+= "

"
document.write(Str)

if(document.all)document.onclick = CheckClick;
}


控制滚动:
=============




无标题文档












分类一


分类二


分类三


分类四


分类五


分类六











=======================================================
检查时间:
================