www.webdeveloper.com
Results 1 to 2 of 2

Thread: innerHTML not showing output

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Posts
    13

    innerHTML not showing output

    I'm trying to display a widget that is called through another page. The "test" word shows up, but the WIDGET portion does not. I know the address works, I can call it through the url and it displays fine so that's not the problem. It's something within the javascript.

    Here's my code:
    Code:
    <script type="text/javascript">
    httpRequest("www.addressto/xxx/xxx/recent-widget.php", showrecent);
    
    //Function to display the widget within innerHTML
    function showrecent(WIDGET){
     d = document.getElementById('recent-widget');
     d.innerHTML = "test" + WIDGET;
    }
    
    //Function to call HTTPRequest
    function httpRequest(url, callback) {
      var httpObj = false;
      if (typeof XMLHttpRequest != 'undefined') {
        httpObj = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        try{
          httpObj = new ActiveXObject('Msxml2.XMLHTTP');
        } catch(e) {
          try{
            httpObj = new ActiveXObject('iMicrosoft.XMLHTTP');
          } catch(e) {}
        }
      }
      if (!httpObj) return;
      httpObj.onreadystatechange = function() {
        if (httpObj.readyState == 4) { // when request is complete
          callback(httpObj.responseText);
        }
      };
      httpObj.open('GET', url, true);
      httpObj.send(null);
    }
    
    
    </script>
    </head>
    <body>
    
    <!-- Div for innerhtml -->
    <div id="recent-widget"></div>
    
    </body>
    </html>
    Can anyone see what's wrong with it?

  2. #2
    Join Date
    Nov 2009
    Posts
    13
    I did some testing and found out that it shows up on my friends computer in both IE and FF. However, it doesn't show up at all on my computer in either. I have adblock plus but even with it turned off it doesn't show up.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles