Using a library function

In this example, the image swapping is done with a function swap_pic(). The function is stored in an external library.

GO OVER AND OUT and click this line!

The source code

        <img src="que.jpg" id="quest3" />

        <p onmouseover="swap_pic('quest3', 'frown.jpg');"   
              onmouseout="swap_pic('quest3', 'smile.jpg');"   
              onclick="swap_pic('quest3', 'que.jpg');"
              style="background-color: yellow;" >
             
            GO OVER AND OUT and click this text!
        </p>