SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict michael - ohio's Avatar
    Join Date
    Dec 2004
    Location
    ohio
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sorry - rookie?? -> onsubmit w/input="image"

    Dumb rookie question:

    In <form....> I commonly use onsubmit() to do something when the submit button is clicked... no big deal...

    Will my onsubmit()s still work when I change my input type from

    input type="submit"
    to
    input type="image" so that I can use a graphic as a button?


    - michael

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not use something like this?
    Code:
    <button type="submit" 
    style="padding:0;border:0 none;background-color:transparent;"
    ><img src="example.png" alt="Submit"></button>
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Addict michael - ohio's Avatar
    Join Date
    Dec 2004
    Location
    ohio
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by [SIZE="1"
    Kravvitz;3379051]Why not use something like this?...[/SIZE]



    um... because I'm 50 and still consider "styles" that new fangled stuff... and because I didn't know you could even do that... and because I'm an idiot?

    Thanks - works great. But out of curiosity, what's the answer to my original question? If you change the input type from "submit" to "image", will the JavaScript "onsubmit" handler still work>

    - michael

  4. #4
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're welcome

    Yes, <input type="image"> elements do trigger onsubmit.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


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
  •