• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Odd jscript problem

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    #11
    I've had this a few times recently on one of my Amazon bots (everything is there when you look at the html but it doesn't exist).



    To fix it I've taken to using document.getElementsByClassName("info")[0].innerHTML=""; to fix it with and using the classNames of the element which means your div will need to be

    <div id="info" class="info"></div>

    equally though a better approach would be

    var info=document.getElementById("info");
    if (info===null){
    info=
    document.getElementsByClassName("info")[0];
    }
    if (info!==null){
    info.innerHTML="";
    }
    merely at clientco for the entertainment

    Comment


      #12
      Cheers eek have a go at that when I 've fixed me curtain rods. Ever had a clue why just one element should not exist and only sometimes? Evil spirits!

      Edit
      Ah. No didn't fix it but ta anyway eek.
      Last edited by xoggoth; 23 December 2020, 15:05.
      bloggoth

      If everything isn't black and white, I say, 'Why the hell not?'
      John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

      Comment


        #13
        IDIOT!

        Bah. Elsewhere in a tool tip function I was setting innerHTML of the container div to "". Sometimes after refresh I would move the mouse over the tool and trigger it.
        Last edited by xoggoth; 23 December 2020, 17:40.
        bloggoth

        If everything isn't black and white, I say, 'Why the hell not?'
        John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

        Comment


          #14
          Originally posted by xoggoth View Post
          Bah. Elsewhere in a tool tip function I was setting innerHTML of the container div to "". Sometimes after refresh I would move the mouse over the tool and trigger it.
          PICNIC

          Comment


            #15
            PICNIC
            Eh??
            bloggoth

            If everything isn't black and white, I say, 'Why the hell not?'
            John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

            Comment


              #16
              Originally posted by xoggoth View Post
              Eh??
              PICNIC - Wiktionary

              Comment


                #17
                Could you possibly have additional elements using the same ID name on the DOM at the time?

                Comment


                  #18
                  Could you possibly have additional elements using the same ID name on the DOM at the time?
                  Don't think so. Think it's all solved now as I said. Initially I used a single box to show tips and details for pins/tracks. Then modified the box to include images relating to pins forgetting I'd used it for the tips.

                  Names can be a problem. Once lazily used names x and y for position in some interactive games, only for them to stop working in Chrome when Google added undocumented properties x and y.
                  Last edited by xoggoth; 24 December 2020, 16:54.
                  bloggoth

                  If everything isn't black and white, I say, 'Why the hell not?'
                  John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

                  Comment


                    #19
                    Originally posted by ladymuck View Post
                    Yeh. I'm an incompetent old fart.
                    bloggoth

                    If everything isn't black and white, I say, 'Why the hell not?'
                    John Wayne (My guru, not to be confused with my beloved prophet Jeremy Clarkson)

                    Comment

                    Working...
                    X