Results 1 to 4 of 4

Thread: [RESOLVED] Picture Swapping

  1. #1
    Join Date
    Nov 2005

    resolved [RESOLVED] Picture Swapping

    I'm working on this website for this company that will allow them to book meetings for there conference rooms. On this site I have a details page that allows the users to see all the details of the room. I have multiple pictures of the room on this page and have it displaying as one large picture and the rest are smaller and set up like tabs. What I want to happen is, when a user clicks on one the smaller pictures it will swap places with the big one. I have the smaller pics as imagebuttons to get the click event. Any help, tips, or links would be greatly appreciated.

  2. #2
    Join Date
    Jul 2003
    You can do this through Javascript

    Firstly the javascript

    <script language="JavaScript">
    function changeimg(imgpath)
    imgprop.src = imgpath;
    // -->

    Then the image link

    <img src="img/defaultimage.gif" name="imgprop" vspace="2" id="imgprop">

    Change defaultimage.gif with the image you want displayed when the page first loads

    Finally the links to change the image

    <a href='javascript:changeimg("img/imageone.gif")'>First Image</a>
    <a href='javascript:changeimg("img/imagetwo.gif")'>Second Image</a>
    <a href='javascript:changeimg("img/imagethree.gif")'>Third Image</a>...

  3. #3
    Join Date
    Nov 2005
    Is there a way to do it in .NET with the code behind?

  4. #4
    Join Date
    Nov 2005
    Does anyone know a way to do this in asp.net (vb) 1.1. The way I have this set up is one main image and four smaller image buttons. When I click any of the image buttons, it should switch with the main image. All the image urls are taken out of a database. The code I have will only swap once, so I end up losing a pic. I will post the code I have right now.

    Private Sub Image1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles Image1.Click
            Dim large As String
            Dim small As String
            large = imgLarge.ImageUrl '''main image
            small = Image1.ImageUrl   '''image button one
            If Page.IsPostBack Then
                If Image1.ImageUrl = large Then
                    Image1.ImageUrl = small
                    imgLarge.ImageUrl = large
                    Image1.ImageUrl = large
                    imgLarge.ImageUrl = small
                End If
            End If
          End Sub
    All help will be appreciated.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center