一些Asp技巧和实用解决方法
2023-06-13 09:13:58 时间
一些Asp技巧和实用解决方法
随机数:
<%randomize%>
<%=(int(rnd()*n)+1)%>
查询数据时得到的记录关键字用红色显示:
<% =replace(RS("字段X"),searchname,"<font color=#FF0000>" & searchname & "</font>") %>
通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>
判断上一页的来源
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"
%>
在下拉菜单中显示年和月
<select name="select">
<%
Dim M_Year
Dim M_Month
Dim M_MonthJ
Dim M_TheMonth
Dim M_YM
For M_Year = 2000 To Year(Date)
M_Month = 12
If M_Year = Year(Date) Then
M_Month = Month(Date)
End If
For M_MonthJ=1 To M_Month
If M_MonthJ < 10 Then
M_TheMonth = "0" & M_MonthJ
Else
M_TheMonth = M_MonthJ
End If
M_YM = M_Year& "-" & M_TheMonth %>
<option value="<%= M_YM %>"><%= M_YM %></option>
<%
Next
Next %>
</select>
检索并删除数据库里的重复记录
conn.execute("delete from table where id not in (select distinct from table)")
随机数:
<%randomize%>
<%=(int(rnd()*n)+1)%>
查询数据时得到的记录关键字用红色显示:
<% =replace(RS("字段X"),searchname,"<font color=#FF0000>" & searchname & "</font>") %>
通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>
判断上一页的来源
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"
%>
在下拉菜单中显示年和月
<select name="select">
<%
Dim M_Year
Dim M_Month
Dim M_MonthJ
Dim M_TheMonth
Dim M_YM
For M_Year = 2000 To Year(Date)
M_Month = 12
If M_Year = Year(Date) Then
M_Month = Month(Date)
End If
For M_MonthJ=1 To M_Month
If M_MonthJ < 10 Then
M_TheMonth = "0" & M_MonthJ
Else
M_TheMonth = M_MonthJ
End If
M_YM = M_Year& "-" & M_TheMonth %>
<option value="<%= M_YM %>"><%= M_YM %></option>
<%
Next
Next %>
</select>
检索并删除数据库里的重复记录
conn.execute("delete from table where id not in (select distinct from table)")
相关文章
- win2008 R2与sql 2005、2008运行asp的时候速度缓慢的解决方法
- ASP应用技术:连接Oracle数据库(asp连接oracle)
- 解决ASP连接MySQL报错的排查方法(asp连接mysql报错)
- ASP动态连接MySQL数据库(asp 连mysql)
- 使用MySQL,让ASP走向新的维度(asp如何用mysql)
- ASP与DW结合MySQL实现强大网站开发(asp dw mysql)
- 使用ASP连接Oracle数据源的简便方式(asp数据源oracle)
- ASP控制下的Oracle数据库管理初体验(asp控制oracle)
- ASP.NET中文件上传下载方法集合
- 解决ASP(图像)上传漏洞的方法
- IIS7下运行Access+Asp的解决方法
- asp下UTF-8页面乱码的解决方法
- asp.net下Request.QueryString取不到值的解决方法
- ASP.NET路径问题的解决方法
- asp.net中DetailsView的使用方法
- Asp.net在IIS上运行不了的解决方法
- asp.net中日历函数Calendar的使用方法
- 先装了FRAMEWORK,后装IIS导致asp.net页面无法访问的解决方法
- ASP.NET在IIS上注册报0x800702e4错误解决方法
- ASP.NETMVC使用Ajax的辅助的解决方法
- ASP.NETMVC中解析淘宝网页出现乱码问题的解决方法
- ASP.NET记录错误日志的实现方法
- ASP.NET两个截取字符串的方法分享
- Windows2003IIS不支持ASP问题的解决方法
- asp.net数据绑定DataBind使用方法
- asp.net2.0中css失效的解决方法