Need to understand code

Hi. Im new to javascript programming. I was doing out the tutorial at webmonkey.com and I came to this exercise. Well I didnt how to get it so I viewed src and came up with this...

image


It works, but why? like the temp=image1; then it changes on the second mouse over. thanks.

Comments

  • : Hi. Im new to javascript programming. I was doing out the tutorial at webmonkey.com and I came to this exercise. Well I didnt how to get it so I viewed src and came up with this...
    :
    : image
    :
    :
    : It works, but why? like the temp=image1; then it changes on the second mouse over. thanks.
    :

    Hi there,

    I'm assuming the images names are bmp1.bmp, bmp2.bmp and bmp3.bmp.

    Here's how it works...IMHO!

    [code]
    -------- ----------
    | TEMP | = | IMAGE1 |
    -------- ----------
    Temp now has bmp1.bmp in it.

    ---------- ----------
    | IMAGE1 | = | IMAGE2 |
    ---------- ----------
    Image2 now has bmp2.bmp in it.

    ---------- ----------
    | IMAGE2 | = | IMAGE3 |
    ---------- ----------
    Image2 now has bmp3.bmp in it.

    ---------- --------
    | IMAGE3 | = | TEMP |
    ---------- --------
    Image3 now has bmp1.bmp in it.
    [/code]

    Theoretically, if you mouseover'd the image 3 times, then clicked, nothing would "look" like it had happened because each mouseover moves the images and moving them 3 times would put them back into their original position.

    Why does it only change on the second is beyond me. In theory, that shouldn't happen unless something is modifying again after these commands are being executed.

    Hope this helps!
    Bradley q:)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion