Learn Scripting Languages from the Master!
So which link did the user click on? You may want to know the answer to this question especially when you are working with dynamic links. When you display dynamic links on your web pages, you likely want to know which link the user has clicked on to direct the user to the appropriate destination page. In the scripting code below, we first generate some dynamic links, and then, our script determines determine which link the user clicks on.
<%dim strClickedLink, arrLinkTextDisplayLinks ()strClickedLink = GetClikedLink ("ClickableLinkID")if strClickedLink <> "" thenresponse.write "You clicked on: " & arrLinkText (strClickedLink)end ifsub DisplayLinks ()dim strLinkText, sOut, intLinkIDintLinkID = 0arrLinkText = Array ("link1", "link2", "link3", _"link4","link5","link6", "link7")sout = "<p>Click on a link below:</p>"sout = sout & "<ul>"for each strLinkText in arrLinkTextsout = sout & "<li><a href='?ClickableLinkID=" & intLinkID & "'>"sout = sout & strLinkText & "</li>"intLinkID = intLinkID + 1nextsout = sout & "</ul>"response.write soutend subfunction GetClikedLink (strLinkVar)GetClikedLink = request.querystring(strLinkVar)end function%>
Click on a link below: