forum

Home / DeveloperSection / Forums / Result of getElementById is null using javascript?

Result of getElementById is null using javascript?

Anonymous User194519-Aug-2013
Hi Mindstick!

Down vote favorite

Just struggling with a Javascript class being used as a method for some cometishian code, how do I have a constructor for this code? The following code is invalid:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">   

<html>   

    <head>   

        <link rel="Stylesheet" href="gStyle.css" />           

        <script type="text/javascript" language="javascript">   

            // Gantt chart object

            function ganttChart(gContainerID) {   

                this.isDebugMode = true;

                this.gContainer = document.getElementById(gContainerID);   

                if (this.isDebugMode) {

                    this.gContainer.innerHTML += "<div id=\"gDebug\">5,5 | 5.1</div>";

                }   

            }               

            var myChart = new ganttChart("chart1");                 

        </script>           

    </head>   

</html>   

<body>   

    <div id="chart1" class="gContainer"></div>   

</body>   

</html>

thanks in advance

Updated on 19-Aug-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By