title: Javascript textcontain get all html tag text as well as script tag text
body: <p>My goal is to count all word in html page as well as count fixed word in html page the prob is that using that function script tag text also get in count so how i remove script tag from counting keywords.
  i this code  <strong>MSO_ContentTable</strong> is id 0f div tag. give me any other solution on jquery also if there. </p>
  
  <pre><code>function CountWord(keyword) {
  
      var word = keyword.toUpperCase(),
          total = 0,
          queue = [document.getElementById('MSO_ContentTable')],
          curr, count = 0;
  
      while (curr = queue.pop()) {
          var check = curr.textContent;
  
          if (check != undefined) {
  
              for (var i = 0; i &lt; curr.childNodes.length; ++i) {
  
                  if (curr.childNodes[i].nodeName == "SCRIPT") {
                      // do nothing
                  }
                  else {
                      switch (curr.childNodes[i].nodeType) {
                          case 3: // 3
                              var myword = curr.childNodes[i].textContent.split(" ");
  
                              for (var k = 0; k &lt; myword.length; k++) {
                                  var upper = myword[k].toUpperCase();
  
                                  if (upper.match(word)) {
                                      count++;
                                      wc++;
                                  }
                                  else  if((upper[0] &gt;= 'A' &amp;&amp; upper[0] &lt;= 'Z') ||
                                           (upper[0] &gt;= 'a' &amp;&amp; upper[0] &lt;= 'z') ||
                                           (upper[0] &gt;= '0' &amp;&amp; upper[0] &lt;= '9')) {
                                      wc++
                                  }                                    
                              }
                          case 1: // 1
                              queue.push(curr.childNodes[i]);
                      }
                  }
              }
        }
  }
  </code></pre>
  
  <p>thx
  other problem is how i remove the tag which have their display property none?</p>