SitePoint Sponsor

User Tag List

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

    Disable Image Submit Button Script

    I'm trying to use the script below to disable an image submit button. For some reason it isn't working. Does anybody see what's wrong with it?

    Code:
    // this goes in the anchor tag for the submit imageonclick="var obj=disable(this);"
     
    // this goes in the form tag
    onsubmit="return disablebutton(obj);" 
     
    // this goes in the head tag
    function disablebutton(obj){
     obj.disabled=true;
    }
    John Saunders

  2. #2
    SitePoint Enthusiast deharocortez's Avatar
    Join Date
    Sep 2004
    Location
    Monterrey, Mexico
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use this

    <input name="img" type="image" src="images/image.jpg" id="button" onsubmit="this.disabled = 'true';">

    or

    <input name="submit" type="submit" id="button" onsubmit="this.disabled = 'true';">

    so the disabled effect only appears in te second case

    Bye
    FFCA1340CCAC3477D2D34327AC0ABB7B


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
  •