#1
  1. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Location
    Brisbane, Australia
    Posts
    1,442
    Rep Power
    29

    Javascript error with MouseOver & Mouse Out


    I'm trying to do up an image based menu to navigate in my web site. I've got the menu loaded up with the base images, but I want to swap the image on mouse over to give users a visual cue that they can click on it.

    The code I'm using is below

    Code:
    <tr>
    				<td valign="top" align="center"><a href="/web/management"><img src="/web/images/data_management_home_link.gif" width="180" height="30" border="0"
    				onMouseOver="swapImg(this, '/web/images/data_management_home_link_ovr.gif')"
    				onMouseOut="swapImg(this, '/web/images/data_management_home_link.gif')"></a><td>
    			</tr>
    When I move the mouse over the menu images nothing happens and internet explorer displays the "This page contains errors" message in the status bar.

    Any ideas as to what could be going wrong?
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    swapImg...?????
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2003
    Location
    Brisbane, Australia
    Posts
    1,442
    Rep Power
    29
    ok that was dumb, I flogged a bit of code from somewhere else and they defined their own function.

    Code:
    function swapImg(o,src) {
    	o.src = src;
    }
    I included that and now it works, but it's such a small function that I wonder whether it's worth it.

    I've substituted

    Code:
    onMouseOver="this.src = '/web/images/myimages/login_ovr.gif'"
    and all is well.

    Thanks for the help, you pointed me at the problem.

IMN logo majestic logo threadwatch logo seochat tools logo