Disable Button via onclick

Discussion in 'JavaScript' started by alwaysintense, Apr 8, 2008.

  1. #1
    Hi,

    I have been working on a download form that needs to be disabled once clicked on. Basically, everything works perfectly unless you run Internet Explorer.

    The Javascript:

    <script language="JavaScript" type="text/javascript">
    function formDisable(id)
    {

    document.getElementById(id).disabled="true";
    document.getElementById(id).src="../images/getitnowbuttonoff.gif";

    }
    </script>

    The input button of the form:

    echo '<INPUT id="' . $id . '" TYPE="image" src="../images/getitnowbutton.gif" width="135" height="29" onclick="formDisable(\'' . $id . '\')">';

    Does anyone have any ideas as to why this works in all browsers save Internet Explorer?
     
    alwaysintense, Apr 8, 2008 IP
  2. GreatMetro

    GreatMetro Peon

    Messages:
    117
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Total shot in the dark... try also giving the input a name...

    <INPUT id="' . $id . '" name="' . $id . '" TYPE...............
     
    GreatMetro, May 12, 2008 IP
  3. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #3
    try enabled = "false" instead of disabled = "true"
     
    crath, May 13, 2008 IP
  4. 2mk_atspace

    2mk_atspace Well-Known Member

    Messages:
    317
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Long ago i try this method too, but can't get it work so beside disable the button i hide using button.innerHTML="".
     
    2mk_atspace, May 13, 2008 IP