Getting IE Error in this code please help

Discussion in 'JavaScript' started by Gunda, Apr 23, 2007.

  1. #1
    hello

    can some one help me i get a error from this code in IE

    function agreeTerms()
    {
    document.getElementById("upload").disabled=false
    document.getElementById("checkBox").checked=true
    }
    function denyTerms()
    {
    document.getElementById("upload").disabled=true
    document.getElementById("checkBox").checked=false
    }
    Code (markup):
    any idea whats wrong ?
     
    Gunda, Apr 23, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    What error do you get?
     
    nico_swd, Apr 23, 2007 IP
  3. Gunda

    Gunda Guest

    Messages:
    344
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    'document.getElementById(...)' is null or not an object

    and the checkbox is like this

    	<input type="checkBox" onclick="if (this.checked) {agreeTerms()} else {denyTerms()}">
    Code (markup):
     
    Gunda, Apr 23, 2007 IP
  4. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You would need to have it be:

    <input id="checkBox" type="checkBox" onclick="if (this.checked) {agreeTerms()} else {denyTerms()}">
    Code (markup):
    to use getElementById() correctly.
     
    giraph, Apr 23, 2007 IP