SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why Isn't My Mouseover Submit Button Working?

    Can somebody tell me why my mouseover submit button isn't working? I've looked it oever several times and I don't see anything thats wrong. When I go to mouseover the button, it comes up with the error: "Description Object Expected".

    Here is the script that pertains to the rollover function:

    Code:
    if (document.images) {
    		but_goOver = new Image();
    		but_goOver.src = "images/but_go_over.gif";
    
    		but_goOff = new Image();
    		but_goOff.src = "images/but_go.gif";
    }
    function ShowHide(imgDocID,imgObjName) {
    		if (document.images)
    		document.images[imgDocID].src = eval(imgObjName + ".src")
    }
     
     
    <form action="" name="loginform">
     
    <a href="javascript:document.loginform.submit();" onMouseOver='ShowHide("but_go","but_goOver");' onMouseOut='ShowHide("but_go","but_goOff");'><img src="images/but_go.gif" width="29" height="17" border="0" name="but_go"></a>
    Any help would be greatly appreciated.
    John Saunders

  2. #2
    SitePoint Addict
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why in God's name do you want a mouseover submit button!? That would be extremely annoying!

  3. #3
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    He is not submitting with the onMouseOver, just swaping the image. The script worked for me in IE6 and NS7. You don't need the document.images stuff either. Here is your code as it worked for me:
    <html>
    <head>
    <title>Image Swap</title>
    <script language="JavaScript">
    but_goOver = new Image();
    but_goOver.src = "1.gif";
    but_goOff = new Image();
    but_goOff.src = "0.gif";
    function ShowHide(imgDocID,imgObjName) {
    document.images[imgDocID].src = eval(imgObjName + ".src" )
    }
    </script>
    </head>
    <body>
    <a href="java script:document.loginform.submit();" onMouseOver='ShowHide("but_go","but_goOver" );' onMouseOut='ShowHide("but_go","but_goOff" );'><img src="0.gif" width="29" height="17" border="0" name="but_go"></a>
    </body>
    </html>

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not just use an <input type="image" /> ???

    They are submit buttons, so you don't need any javascript hoo-ha to get the form to submit.
    Last edited by beetle; Mar 13, 2003 at 15:49.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





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
  •