如何根据数据库值禁用链路(ASP页) [英] How to disable a link based on the database value (ASP page)
问题描述
我想禁用基于数据库值(ASP页)上的链接。有谁知道如何做到这一点?是否有任何可用的例子?需要你的帮助。谢谢你。
I would like to disable a link based on the database value (ASP page). Does anyone know how to do this? Are there any example available? Need your help. Thanks.
推荐答案
这是一个pretty模糊的问题,但在传统的ASP,您可以使用VBScript来测试你的数据库值,然后RESPONSE.WRITE退出了锚标记或刚刚与文本的span标签:
This is a pretty vague question but in Classic ASP you can use VBScript to test your database value and then Response.Write out either the anchor tag or just a span tag with the text:
<%
If CBool(rs("showlink")) = True Then
%>
<a href="somewhere.asp">Link Text</a>
<%
Else
%>
<span>Link Text</span>
<%
End If
%>
这假设你得到一个记录从数据库(名为RS)回来,它有一个字段上叫showlink,用于指示是否锚标记应显示与否。小边注:请记住,显示或隐藏锚标记不正确认证/安全的替代品
This assumes that you are getting a recordset back from the database (named rs) and that it has a field on it called "showlink" that will indicate if the anchor tag should be displayed or not. Small side note: Keep in mind that showing or hiding the anchor tag is not a replacement for proper authentication/security.
这篇关于如何根据数据库值禁用链路(ASP页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!