SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2001
    Location
    Philadelphia
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with a rollover script

    I learned how to do javascript image rollovers using code I found in a site point tech times newsletter. It works great with href images, but I can't get it to work for a "form submit" image.

    Can someone help me?

    Here's the code I'm using: (don't worry, I included the script opening and closing tags)

    if (document.images) {
    image1up = new Image();
    image1up.src = '../images/submitbutton.jpg';
    image1over = new Image();
    image1over.src = '../images/submitbutton_over.jpg';
    image2up = new Image();
    image2up.src = '2up.gif';
    image2over = new Image();
    image2over.src = '2over.gif';

    <input type="image" src="../images/SubmitButton.JPG" class="form" name="thebutton" onMouseOver="document.thebutton.src=image1over.src" onMouseOut="document.thebutton.src=image1up.src">

    When I mouse over the button, I get an error telling me that document.thebutton is null or not an object.

    Help!
    Mcoolio
    www.trueposition.com

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure about your error message but your src. link for the <input type> tag is wrong.

    In the code at the top it is submitbutton.jpg whereas in your tag it is SubmitButton.JPG

    You say you included script tags, did you include the closing } which appears to be missing.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky


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
  •