Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

carrying a variable through a link - ASP

Options
  • 20-06-2003 5:11pm
    #1
    Registered Users Posts: 1,747 ✭✭✭


    I think this is the best way to do it but im not sure and i dont know how so your help would be very much appreciated. The online version of what im talking about is here: http://www.dgi.ie/polls/pollmentor.asp
    First 2 images work.


    On a page of about 50 tumbnail images (numbered 1-50) i have a link coming from each image that looks like this:


    <a href="../t_images/close_up/close_up<%=nCount%>.asp" target="_blank">

    <img src="../t_images/designs/design<%=nCount%>.gif" border="0"/>

    </a>



    The page it opens contains a larger version of the tumbnail with 2 links at the bottom to view the image number above and below the current one.

    Now i dont want to be creating 50 individual pages to show the larger images when im pretty sure it could be done in one asp page.

    What i want to know is how do i carry this variable <%=nCount%> over to the new window.

    What will the new page look like?
    i think i can do most of this bit but how do you get the links at the bottom to go one number above and one below as well as not showing a link for the previous image if current is 'design1'
    And the same for 'design50'

    I hope that makes sense and thanks for taking the time.


Comments

  • Registered Users Posts: 437 ✭✭Spunj


    You want to have a link to the same asp page and use the count variable to display the image based on its name by passing it to the new page in the querystring.

    E.g. href="blah.asp?id=<%=nCount%>"

    ---
    blah.asp

    id = Cint(Request("id"))

    ..blah blah
    <img src="../t_images/designs/design<%=id%>.gif" border="0"/>
    ..blah blah


    Something along those lines will sort ya out.


  • Registered Users Posts: 1,268 ✭✭✭hostyle


    <%

    nCount = int(Request("imagenum"))

    %>


    <a href="../t_images/close_up/close_up.asp?imagenum=<%=nCount-1%>" target="_blank">

    <img src="../t_images/designs/design<%=nCount-1%>.gif" border="0"/>

    </a>


    <a href="../t_images/close_up/close_up.asp?imagenum=<%=nCount+1%>" target="_blank">

    <img src="../t_images/designs/design<%=nCount+1%>.gif" border="0"/>

    </a>


    You'll have to do some extra checking to see if there is a previous and next image but that should get you going ...


  • Registered Users Posts: 1,747 ✭✭✭Figment


    Brilliant, cheers lads.


  • Registered Users Posts: 1,747 ✭✭✭Figment


    works a charm :)


Advertisement