Change image by clicking link

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • -DRB-

    Change image by clicking link

    I suspect this is fairly standard practice, but I've looked on the net
    and can't quite find the script I want.

    I would like to have a page with an image on which changed depending
    on which link next to it is clicked... there will be about 5/6 links
    and their associated image.

    Thanks very much indeed.

    Dave.
  • Evertjan.

    #2
    Re: Change image by clicking link

    -DRB- wrote on 18 okt 2003 in comp.lang.javas cript:
    [color=blue]
    > I suspect this is fairly standard practice, but I've looked on the net
    > and can't quite find the script I want.
    >
    > I would like to have a page with an image on which changed depending
    > on which link next to it is clicked... there will be about 5/6 links
    > and their associated image.[/color]

    <img src="img0.jpg" id="im">

    <a href=".." target="_blank"
    onclick="docume nt.getElementBy Id('im').src='i mg1.jpg'">
    .... </a>

    <a href=".." target="_blank"
    onclick="docume nt.getElementBy Id('im').src='i mg2.jpg'">
    .... </a>

    <a href=".." target="_blank"
    onclick="docume nt.getElementBy Id('im').src='i mg3.jpg'">
    .... </a>


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Geir Klemetsen

      #3
      Re: Change image by clicking link


      "Evertjan." <exjxw.hannivoo rt@interxnl.net > skrev i melding
      news:Xns9418E64 5B1F7Deejj99@19 4.109.133.29...[color=blue]
      > -DRB- wrote on 18 okt 2003 in comp.lang.javas cript:
      >[color=green]
      > > I suspect this is fairly standard practice, but I've looked on the net
      > > and can't quite find the script I want.
      > >
      > > I would like to have a page with an image on which changed depending
      > > on which link next to it is clicked... there will be about 5/6 links
      > > and their associated image.[/color]
      >
      > <img src="img0.jpg" id="im">
      >
      > <a href=".." target="_blank"
      > onclick="docume nt.getElementBy Id('im').src='i mg1.jpg'">
      > ... </a>
      >
      > <a href=".." target="_blank"
      > onclick="docume nt.getElementBy Id('im').src='i mg2.jpg'">
      > ... </a>
      >
      > <a href=".." target="_blank"
      > onclick="docume nt.getElementBy Id('im').src='i mg3.jpg'">
      > ... </a>
      >
      >
      > --
      > Evertjan.
      > The Netherlands.
      > (Please change the x'es to dots in my emailaddress)[/color]

      And the image size of the replaced picture must be the same as the original
      picture, or?


      Comment

      • Evertjan.

        #4
        Re: Change image by clicking link

        Geir Klemetsen wrote on 19 okt 2003 in comp.lang.javas cript:[color=blue]
        > "Evertjan." <exjxw.hannivoo rt@interxnl.net > skrev i melding[color=green][color=darkred]
        >> > I would like to have a page with an image on which changed
        >> > depending on which link next to it is clicked... there will be
        >> > about 5/6 links and their associated image.[/color]
        >>
        >> <img src="img0.jpg" id="im">
        >>
        >> <a href=".." target="_blank"
        >> onclick="docume nt.getElementBy Id('im').src='i mg1.jpg'">
        >> ... </a>
        >>
        >> <a href=".." target="_blank"
        >> onclick="docume nt.getElementBy Id('im').src='i mg2.jpg'">
        >> ... </a>
        >>
        >> <a href=".." target="_blank"
        >> onclick="docume nt.getElementBy Id('im').src='i mg3.jpg'">
        >> ... </a>[/color]
        > And the image size of the replaced picture must be the same as the
        > original picture, or?[/color]

        "Must" is too much,
        but it is the usual idea with image replacing,
        if you want to keep the user happy.


        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        Working...