Forum Moderators: open
I have a store in which I would like to add a random link in the thanks.asp page after customers buy from us.
The random link is to invite them to join our form, and then randomly show to a next buyer an invitation to join our newsletter, and lastly an invitation to complete our survey.
I want these links to show randomly instead of all of them to avoid confusing customers or making them think too much about where to go or which option to choose.
How could I do this in this asp page.
Thanks,
To acheive what you are asking, you want something like this...
<script language="vbscript" runat="server">
Dim linkToShow
Dim showLinkshowLink = cInt(Application("showLink"))
If Len(cstr(showLink)) = 0 or showLink = 4 Then
Application("showlink") = 1
showLink = 1End If
If showLink = 1 Then linkToShow = "http://www.example.com/forum.asp"
If showLink = 2 Then linkToShow = "http://www.example.com/newsletter.asp"
If showLink = 3 Then linkToShow = "http://www.example.com/survey.asp"
Application("showlink") = showLink + 1
</script>
<a href="<a href="<%=linkToShow%>">click here</a>
<%
Dim strLinks(3,2)
strLinks(0,0) = "http://www.ex.com/forum.asp" : strLinks(0,1) = "Click to Visit Our Forum..."
strLinks(1,0) = "http://www.ex.com/survey.asp" : strLinks(1,1) = "Click to Complete Our Survey..."
strLinks(2,0) = "http://www.ex.com/newsletter.asp" : strLinks(2,1) = "Click to Sign-up to Our News Letter..."
Randomize
Dim intID :intID = (Int(3 * Rnd) + 1) - 1
Response.Write "<a href=""" & strLinks(intID,0) & """>" & strLinks(intID,1) & "</a><br>" & vbCrLf
%>