#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Frederick,MD USA
    Posts
    6
    Rep Power
    0
    I am trying to perform an image swap in a form using the input type of 'image'. For some reason, onmouseover or onmouseout does not work when I assign it different images:

    <form onsubmit="window.open('weblink.html')">
    <input name="image1' type=image src="image.jpg" border=0 onclick="submit()"
    onmouseover="document.image1.src="imagealt.jpg"
    onmouseout="document.image1.src="image.jpg">
    </form>
    I have tried using onmouseout/onmouseover in various combinations to achieve the effect and it only seems to work OUTSIDE of the form tags.
    Can anyone offer any useful advice?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    6
    Rep Power
    0
    a couple of things:

    make sure you keep your single and double quotations straight.

    if you embed javascript, call it first by saing javaScript: and then the stuff you want.

    <form onsubmit="window.open('weblink.html')">
    <input name="image1" type="image" src="image.jpg" border=0 onclick="submit()"
    onmouseover="javaScript:document.image1.src='imagealt.jpg';return true;"
    onmouseout="document.image1.src='image.jpg';
    return true;">
    </form>

    see if that works, otherwise move the rollover to a function and call that function.

    -b

Similar Threads

  1. Finding Images in HTML
    By beardo in forum PHP Development
    Replies: 14
    Last Post: March 28th, 2004, 07:29 AM
  2. Browser (cache?) problem after image upload
    By mugane in forum PHP Development
    Replies: 7
    Last Post: November 4th, 2003, 12:39 PM
  3. image swapping
    By slm in forum HTML Programming
    Replies: 2
    Last Post: March 17th, 2003, 08:52 PM
  4. Javascript image preload race condition
    By lmcccha in forum JavaScript Development
    Replies: 5
    Last Post: February 13th, 2003, 09:21 PM
  5. swapping an image in a layer
    By szyslak in forum HTML Programming
    Replies: 1
    Last Post: August 13th, 2001, 04:20 PM

IMN logo majestic logo threadwatch logo seochat tools logo