Forum Moderators: open

Message Too Old, No Replies

random link for thanks.asp page

I would like to have a random link added to my thanks.asp page

         

rominosj

5:39 am on Sep 6, 2005 (gmt 0)

10+ Year Member



Hello,

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,

mrMister

6:30 am on Sep 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What you're describing isn't random.

To acheive what you are asking, you want something like this...


<script language="vbscript" runat="server">
Dim linkToShow
Dim showLink

showLink = cInt(Application("showLink"))

If Len(cstr(showLink)) = 0 or showLink = 4 Then

Application("showlink") = 1
showLink = 1

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

badger111

11:46 pm on Sep 6, 2005 (gmt 0)

10+ Year Member



If you fancy a 'psuedo-random' link use something like this.....

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