+ Reply to Thread
Results 1 to 5 of 5

Thread: change submit button for image

  1. #1
    bunglebrown is offline x10 Sophmore bunglebrown is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    157

    Question change submit button for image

    I'm more than a little stuck with this but I'm sure someone can help-

    I have a form that is posted to a php page on submitting. I want to change the standard submit button to something more customised - like an image that I have created. Here's the code that I have for this. Currently the image is shown on top of an ugly submit button. I want to remove the button below so if anyone can direct me on how to do this I would be real grateful.

    Code:
    <div align="right"><button type="submit"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('next','','nextrollover.gif',1)"><img src="next.gif" width="170" height="40" border="0" id="next"></a></button></div>

  2. #2
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    Re: change submit button for image

    Quote Originally Posted by bunglebrown View Post
    I want to change the standard submit button to something more customised - like an image that I have created.
    I'm unsure... do you want the image to change when something happens (such as the user pressing a button) or do you just want to use a custom image instead of a submit button?

    If it's the latter, the following simple piece of HTML can be used instead of <input type='submit'> or as you did, <button type='submit'>
    HTML Code:
    <input type='image' src='images/submit.png' value='Submit' alt='Submit'>
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

  3. #3
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: change submit button for image

    That would work but he also wants the image to be a rollover image.

    Just use this:
    HTML Code:
    <script>
    function subForm(){
    document.FORMNAME.submit();
    }
    </script>
    <div align="right"><a href="javascript:subForm();" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('next','','nextrollover.gif',1)"><img src="http://forums.x10hosting.com/programming-help/next.gif" width="170" height="40" border="0" id="next"></a></div>
    Of course you're going to have to change FORMNAME to match the name="" attribute in the <form> tag.
    Last edited by VPmase; 09-22-2008 at 04:40 PM.

  4. #4
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    Re: change submit button for image

    Only problem with that method is that non-JS browsers will not be able to submit the form.
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

  5. #5
    bunglebrown is offline x10 Sophmore bunglebrown is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    157

    Re: change submit button for image

    exactly what I'm talking about scoochie!! thanks - you really pulled it out there. Incidentally I incorporated the rollover like this - a big thanks for the concern from all.

    Code:
    <input type='image' src='next.gif' width="160" height="36" value='Submit' border="0" id="nextstep" alt='Submit' onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('next','','nextrollover.gif',1)"
    >

+ Reply to Thread

Similar Threads

  1. email submit button
    By mahlerwd in forum Programming Help
    Replies: 18
    Last Post: 05-21-2008, 08:02 PM
  2. email - submit button
    By mahlerwd in forum Free Hosting
    Replies: 1
    Last Post: 05-14-2008, 11:53 PM
  3. Flash button for 50 Credits:
    By satheesh in forum The Marketplace
    Replies: 4
    Last Post: 01-25-2008, 08:43 AM
  4. Firefox 'Back' Button Problems
    By GG-Xtreme in forum Off Topic
    Replies: 3
    Last Post: 12-14-2007, 10:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers