Can anyone help me?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J. Nielsen

    Can anyone help me?

    I'm not a programmer and I don't have the time and energy to start learning
    right now So I need some help.

    Let's say I have made an HTML Table (consisting of three columns and six
    rows). In each cell, in the first column I have put in an image (six
    different ones).
    In the second column I have merged all six cells into one cell and there put
    in an image matching the background colour.
    In the right column I have again put in six different pictures, one in each
    cell.

    What I now want is, when I MouseOver the first top-left picture the middle
    image shall change into another as well as the top right image shall change.
    When I remove the pointer from the image both the changed images shall turn
    back again.

    When I MouseOver the second-left picture, again the middle image shall
    change as well as the second-right picture, and so on and so on.

    Can anyone help me?


    Jannick.






  • kaeli

    #2
    Re: Can anyone help me?

    In article <407ed391$0$300 $edfadb0f@dread 12.news.tele.dk >, [Nospam]
    jannick.nielsen 2@skolekom.dk enlightened us with...[color=blue]
    > I'm not a programmer and I don't have the time and energy to start learning
    > right now So I need some help.
    >[/color]
    <snip>[color=blue]
    >
    > Can anyone help me?
    >[/color]

    How much does the job pay?


    --
    --
    ~kaeli~
    Santa's helpers are subordinate clauses.



    Comment

    • J. Nielsen

      #3
      Re: Can anyone help me?

      > How much does the job pay?

      Yeah, that's a good question!
      This is actually an idea I got from another web site with some
      modifications. Unfortunately that site no longer excists, .
      The guy (a Norwegian) who made the web site once promised me to show me how
      he had done this. I don't know what happened to him. Can't get in contact
      with him anymore.

      It is a simple "image change" script (as far as I understand). I tried to
      sit down and make it myself, but I only got the "MouseOver-image" to change.
      I thought that some might have done this before and had the script lying
      around somewhere.

      Jannick.


      Comment

      • mscir

        #4
        Re: Can anyone help me?

        J. Nielsen wrote:
        <snip>[color=blue]
        > What I now want is, when I MouseOver the first top-left picture the middle
        > image shall change into another as well as the top right image shall change.
        > When I remove the pointer from the image both the changed images shall turn
        > back again.
        > When I MouseOver the second-left picture, again the middle image shall
        > change as well as the second-right picture, and so on and so on.[/color]

        This might get you started, give the images you want to change a unique
        id (and matching name). This will allow you to change their src to
        display a different image.

        var imgsrc = new Array();
        imgsrc[1]=new Array();
        imgsrc[1][0]='art_1.jpg';
        imgsrc[1][1]='amber_sm_3.jp g';
        imgsrc[2]=new Array();
        imgsrc[2][0]='art_2.jpg';
        imgsrc[2][1]='amber_sm_4.jp g';

        function changepics(num) {
        var bigpic=document .getElementById ('bigpic');
        bigpic.src=imgs rc[num][0];
        var littlepic=docum ent.getElementB yId('littlepic' +num);
        littlepic.src=i mgsrc[num][1];
        }
        </script>
        </head>

        <body>

        <table border="1" cellspacing="1" width="861">
        <tr>
        <td width="149"><im g border="0" src="art_1_sm.j pg" width="144"
        height="110" onMouseOver="ch angepics(1)">&n bsp;</td>
        <td width="602" rowspan="4"><im g border="0" src="art_3.jpg"
        width="600" height="450" name="bigpic" id="bigpic"></td>
        <td width="149"><im g name="littlepic 1" id="littlepic1 " border="0"
        src="amber_sm_1 .jpg" width="144" height="108">&n bsp;</td>
        </tr>
        <tr>
        <td width="149"><im g border="0" src="art_2_sm.j pg" width="144"
        height="108" onMouseOver="ch angepics(2)">&n bsp;</td>
        <td width="149"><im g name="littlepic 2" id="littlepic2 " border="0"
        src="amber_sm_2 .jpg" width="144" height="108">&n bsp;</td>
        </tr>
        </table>

        Comment

        • Richard Cornford

          #5
          Re: Can anyone help me?

          mscir wrote:
          <snip>[color=blue]
          > var imgsrc = new Array();
          > imgsrc[1]=new Array();
          > imgsrc[1][0]='art_1.jpg';
          > imgsrc[1][1]='amber_sm_3.jp g';
          > imgsrc[2]=new Array();
          > imgsrc[2][0]='art_2.jpg';
          > imgsrc[2][1]='amber_sm_4.jp g';[/color]
          <snip>

          You really should become familiar with writing Array literals, which can
          appear in array literals, producing as near to multi-dimensional arrays
          as javascript gets:-

          var imgsrc = [
          [
          'art_1.jpg',
          'amber_sm_3.jpg '
          ],
          [
          'art_2.jpg',
          'amber_sm_4.jpg '
          ]
          ];

          Richard.


          Comment

          • kaeli

            #6
            Re: Can anyone help me?

            In article <407f5c66$0$269 $edfadb0f@dread 12.news.tele.dk >, [Nospam]
            jannick.nielsen 2@skolekom.dk enlightened us with...[color=blue]
            >
            > It is a simple "image change" script (as far as I understand). I tried to
            > sit down and make it myself, but I only got the "MouseOver-image" to change.
            > I thought that some might have done this before and had the script lying
            > around somewhere.
            >[/color]



            If all you need is the image swap function, search the archives.
            There's tons.


            &q=image+swap&b tnG=Search&meta =group%3Dcomp.l ang.javascript

            Also, dynamic drive probably has some canned ones.


            --
            --
            ~kaeli~
            What if the Hokey Pokey IS what's it's all about?



            Comment

            • mscir

              #7
              Re: Can anyone help me?

              Richard Cornford wrote:[color=blue]
              > mscir wrote:
              > <snip>
              >[color=green]
              >>var imgsrc = new Array();
              >>imgsrc[1]=new Array();
              >>imgsrc[1][0]='art_1.jpg';
              >>imgsrc[1][1]='amber_sm_3.jp g';
              >>imgsrc[2]=new Array();
              >>imgsrc[2][0]='art_2.jpg';
              >>imgsrc[2][1]='amber_sm_4.jp g';[/color]
              >
              > <snip>
              >
              > You really should become familiar with writing Array literals, which can
              > appear in array literals, producing as near to multi-dimensional arrays
              > as javascript gets:-
              >
              > var imgsrc = [
              > [
              > 'art_1.jpg',
              > 'amber_sm_3.jpg '
              > ],
              > [
              > 'art_2.jpg',
              > 'amber_sm_4.jpg '
              > ]
              > ];[/color]

              Thanks Richard, that did seem inefficient.

              If I wanted to use that approach and still control the 1st dimension
              indexes, say to non zero-beginning, or non-consecutive numbers, is this
              the most efficient way to approach it?

              var imgsrc = new Array();
              imgsrc[3]=['art_1.jpg','am ber_sm_3.jpg'];
              imgsrc[5]=['art_2.jpg','am ber_sm_4.jpg'];

              Mike

              Comment

              Working...