javascript case randomize

javascript case randomize
<script type="text/javascript">
function curry (n) {
  // We would use Node.TEXT_NODE for this conditional,
  // but the "programmers" at Microsoft have their heads
  // up their asses so far they can see out of their
  // own nostrils:
  if ( n.nodeType == 3 ) {
    n.data = scrambleCase( n.data );
  }
  var kids = n.childNodes;
  var str = '';
  for ( var i = 0; i < kids.length; i++ ) {
    var ret = curry( kids[i] );
    str += ret;
  }
  return str;
}
function scrambleCase (txt) { var wordish = txt.split(' '); for ( var i = 0; i < wordish.length; i++ ) { var w = new Array () for ( var n = 0; n < wordish[i].length; n++ ) { var letter = wordish[i].charAt(n); if ( ( Math.random() * 2 ) > 1 ) { letter = letter.toLowerCase(); } else { letter = letter.toUpperCase(); } w.push( letter ); } wordish[i] = w.join(''); } return wordish.join(' '); } </script>
[close] Permanent link · http://querylog.com/q/javascript+case+randomize

Suggested HTML for linking:
Link preview: javascript case randomize
02 August 2005 · Internet & computing
The page found by the original query:
Randomize arrays in JavaScript with the Fi…
Browse by the page—15 Q&R each
« previous | more »