SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot sonique's Avatar
    Join Date
    Sep 2001
    Location
    Missouri [U.S.]
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript: Mouseover

    Eh, i have a mouse over
    I hold mouse over the image.......it changes..
    i move mouse away....it doesn't change back
    i move mouse back over...it repeats the change...

    here is the code

    Code:
    <Script Language="JavaScript">
    if (document.images) {
    	var gallery_off = new Image();	
    		gallery_off.src = "images/mouse_off.gif";
    	var gallery_on = new Image();
    		gallery_on.src = "images/gallery_on.gif";
    	var pfolio_off = new Image();
    		pfolio_off.src = "images/mouse_off.gif";
    	var pfolio_on = new Image();
    		pfolio_on.src = "images/pfolio_on.gif";
    	var links_off = new Image();
    		links_off.src = "images/mouse_off.gif";
    	var links_on = new Image();
    		links_on.src = "images/links_on.gif";	
    }
    function act (imgName) {
    	if (document.images)
    		document.images[imgName].src = eval (imgName + "_on.src");
    }
    function inact (imgName) {
    	if (document.image)
    		document.images[imgName].src = eval (imgName + "_off.src");
    }
    
    </Script>
    <table border="0" cellspacing="0" cellpadding="0">
    <tr><td>
    <A href="#" onMouseOver="act('gallery')" onMouseOut="inact('gallery')">
    <Img src="images/mouse_off.gif" name="gallery" alt="Gallery" border="0"></a>
    </td><td>
    <A href="#" onMouseOver="act('pfolio')" onMouseOut="inact('pfolio')">
    <Img src="images/mouse_off.gif" name="pfolio" alt="Gallery" border="0"></a>
    </td></tr>
    </table>
    jmulder[THE MENTOR]'s nice guy online!
    Rig: AMD Athlon 800mhz; 384mb SDRam; 32mb nVidia @ 1024x768; ie 6; Windows ME; 15 gig; Cd-RW

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm confused. Have you defined functions for act and inact?

    Sketch
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Zealot sonique's Avatar
    Join Date
    Sep 2001
    Location
    Missouri [U.S.]
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes......look at the code closely
    jmulder[THE MENTOR]'s nice guy online!
    Rig: AMD Athlon 800mhz; 384mb SDRam; 32mb nVidia @ 1024x768; ie 6; Windows ME; 15 gig; Cd-RW

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...der....I feel dumb. I looked and I coulda swore it wasn't there.

    Sketch
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Zealot sonique's Avatar
    Join Date
    Sep 2001
    Location
    Missouri [U.S.]
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    back at top
    jmulder[THE MENTOR]'s nice guy online!
    Rig: AMD Athlon 800mhz; 384mb SDRam; 32mb nVidia @ 1024x768; ie 6; Windows ME; 15 gig; Cd-RW

  6. #6
    SitePoint Member
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could it be the simple error in the mouseoff function? you have:

    function inact (imgName) {
    if (document.image)
    document.images...

    shouldn't it be:

    function inact (imgName) {
    if (document.images)
    document.images...


    NOTE: Missing "s".


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •