Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. Clever Code
  4. JavaScript bug

JavaScript bug

Scheduled Pinned Locked Moved Clever Code
helpjavascriptdebuggingquestion
5 Posts 4 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rama Krishna Vavilala
    wrote on last edited by
    #1

    var splitter;

    function CreateSplitter()
    {
    spliter = document.createElement("div");
    spliter.innerHTML = "Some Text";

    document.body.appendChild(spliter);
    }

    function XYZ()
    {
    //Later in the code
    splitter.innerHTML = "Some thing else";
    }

    Sometimes when I am fortunate I get "object does not support this property or method" at other times it is very difficult to figure out what is going on. Whether you use global variables or closures the problem occurs.


    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

    C S 2 Replies Last reply
    0
    • R Rama Krishna Vavilala

      var splitter;

      function CreateSplitter()
      {
      spliter = document.createElement("div");
      spliter.innerHTML = "Some Text";

      document.body.appendChild(spliter);
      }

      function XYZ()
      {
      //Later in the code
      splitter.innerHTML = "Some thing else";
      }

      Sometimes when I am fortunate I get "object does not support this property or method" at other times it is very difficult to figure out what is going on. Whether you use global variables or closures the problem occurs.


      Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      Took me a while. Don't you sometimes wish Javascript had an Option Explicit? ;)

      cheers, Chris Maunder

      CodeProject.com : C++ MVP

      S T 2 Replies Last reply
      0
      • C Chris Maunder

        Took me a while. Don't you sometimes wish Javascript had an Option Explicit? ;)

        cheers, Chris Maunder

        CodeProject.com : C++ MVP

        S Offline
        S Offline
        Shog9 0
        wrote on last edited by
        #3

        Yes.

        I am tired and sleepy that's why i am at office. -- Adnan Siddiqi, The Soapbox's Future

        1 Reply Last reply
        0
        • R Rama Krishna Vavilala

          var splitter;

          function CreateSplitter()
          {
          spliter = document.createElement("div");
          spliter.innerHTML = "Some Text";

          document.body.appendChild(spliter);
          }

          function XYZ()
          {
          //Later in the code
          splitter.innerHTML = "Some thing else";
          }

          Sometimes when I am fortunate I get "object does not support this property or method" at other times it is very difficult to figure out what is going on. Whether you use global variables or closures the problem occurs.


          Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan

          S Offline
          S Offline
          Shog9 0
          wrote on last edited by
          #4

          Oh wow. I've spent close to an hour looking for a similar bug. Was to the point of re-writing a whole event-handling system when i finally saw it. :doh:

          I am tired and sleepy that's why i am at office. -- Adnan Siddiqi, The Soapbox's Future

          1 Reply Last reply
          0
          • C Chris Maunder

            Took me a while. Don't you sometimes wish Javascript had an Option Explicit? ;)

            cheers, Chris Maunder

            CodeProject.com : C++ MVP

            T Offline
            T Offline
            TNCaver
            wrote on last edited by
            #5

            Option Explicit and a full IDE with breakpoints, variable watching and single-line step-through debugging!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups