SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.getElementById("C1") is null

    Error: document.getElementById("C1") is null
    Source File: http://localhost:2276/main.aspx
    Line: 34

    i am getting this error the same script was working fine yest
    but now i get the above error

    on window.load function

    how do i trace for error

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by svibuk View Post
    Error: document.getElementById("C1") is null
    Source File: http://localhost:2276/main.aspx
    Line: 34

    i am getting this error the same script was working fine yest
    but now i get the above error

    on window.load function

    how do i trace for error
    You do keep backups don't you? Or even better, use some form of version control?

    Go back to the code that worked yesterday, and work forward through that changes that have since been made, testing until you narrow down what caused the problem.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that i have already started
    but just wanted to know abt this error & ways to solve it so that its useful in future

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by svibuk View Post
    that i have already started
    but just wanted to know abt this error & ways to solve it so that its useful in future
    Given that it previously worked, it means that the element that used to have an id of "C1" on it is now no longer available.

    There can be a few different reasons why this might occur:

    1. The element used to be there but has now been removed
    2. Something has happened to cause the element to be added to the page later than the code which needs to access it
    3. The code that needs to access the element runs before the element has been created

    How I would approach this is to set a breakpoint on the offending line, and investigate the HTML and scripting code to find out what clues might be divulged from such an investigation.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Guru
    Join Date
    Dec 2008
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am not sure abt the reason
    but i have a grid on the page if i set the autopost back property of the grrid to true i get the above error


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
  •