一些Asp技巧和实用解决方法
随机数:
<%randomize%>
<%=(int(rnd()*n)+1)%>
查询数据时得到的记录关键字用红色显示:
<%=replace(RS("字段X"),searchname,"<fontcolor=#FF0000>"&searchname&"</font>")%>
通过asp的手段来检查来访者是否用了代理
<%ifRequest.ServerVariables("HTTP_X_FORWARDED_FOR")<>""then
response.write"<fontcolor=#FF0000>您通过了代理服务器,"&_
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
endif
%>
判断上一页的来源
request.servervariables("HTTP_REFERER")
javascript:document.referrer
清除缓存,重新加载页面
<%response.expires=0
response.expiresabsolute=now()-1
response.addHeader"pragma","no-cache"
response.addHeader"cache-control","private"
Response.cachecontrol="no-cache"
%>
在下拉菜单中显示年和月
<selectname="select">
<%
DimM_Year
DimM_Month
DimM_MonthJ
DimM_TheMonth
DimM_YM
ForM_Year=2000ToYear(Date)
M_Month=12
IfM_Year=Year(Date)Then
M_Month=Month(Date)
EndIf
ForM_MonthJ=1ToM_Month
IfM_MonthJ<10Then
M_TheMonth="0"&M_MonthJ
Else
M_TheMonth=M_MonthJ
EndIf
M_YM=M_Year&"-"&M_TheMonth%>
<optionvalue="<%=M_YM%>"><%=M_YM%></option>
<%
Next
Next%>
</select>
检索并删除数据库里的重复记录
conn.execute("deletefromtablewhereidnotin(selectdistinctfromtable)")
一些Asp技巧和实用解决方法
2021-05-25 21:27:09声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。 如涉及版权问题,请提交至online#300.cn邮箱联系删除。
热门文章