[thelist] .innerHTML help

Lindsay Evans lindsay at redsquare.com.au
Tue Sep 3 22:43:01 CDT 2002


> Works like a charm, but I'd still like to get the number of *'s to match
> the number of letters of each censored word.

Expanding on Aaron's code:

   function censor() {
     var totalSpans = content.getElementsByTagName("span").length;
     spans = document.body.getElementsByTagName("span");
     if (document.styleForm.swearFilter.checked) {
       for (i=0;i<totalSpans;i++) {
	   naughty = '';
	   for(ii=0; ii<=spans[i].innerHTML.length; i++){
	     naughty += '*';
	   }
         spans[i].oldInnerHTML = spans[i].innerHTML;
         spans[i].innerHTML = naughty;
       }
     } else {
       for (i=0;i<totalSpans;i++) {
         spans[i].innerHTML = spans[i].oldInnerHTML;
       }
     }

   }


--
 Lindsay Evans.
 Developer,
 Red Square Productions.

 [p] 8596.4000
 [f] 8596.4001
 [w] www.redsquare.com.au




More information about the thelist mailing list