1.) ActiveX is only supported by IE and, given the security risks, even Microsoft has largely locked down the functionality in IE8+. This is not something that can be attempted cross-browser.
2.) If you replace every 'A' with a 'W' for instance, then replace every 'W' with a 'S', you will inadvertently have turned every 'A' and every 'W' into an 'S'. Depending on your goal This may be a critical flaw.
3.) If the letter transformation is completely random, there will be no clear way of reverting the process to restore the original content. Again, this may or may not be a deal-breaker.
It can be done (see JavaScript's regex functionality), but keep in mind the above before investing time in a problematic implementation.
John
I'm trying to do a little personal experiment with changing the text in a document through JavaScript and I'm kind of lost :s. I'm not too good with JavaScript yet, only just started trying to learn a couple days ago. Here's my code:
<script type="text/javascript">
var xtc = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D ","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U", "V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0","!","@","# ","$","%","^","&","*","(",")","-","_","+","=","[","{","]","}","|","\\" ,";",":","\"","'","/","?",">","<",",",".","~","`");
function fd() {
//using this function I'm able to write a random character from Array xtc to the document loaded
var za = xtc[Math.floor(Math.random()*90)];
return za;
}
function writeToDoc() {
//opens the document, writes the value returned in fd(), and then closes the file
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fh = fso.CreateTextFile(document.getElementById('txtfile').value, true);
fh.WriteLine(fd());
fh.Close();
}
</script>
...
<!--finds the file, and then once selected, writeToDoc() is performed, writing to the document-->
<input type="file" onChange="writeToDoc(this)" id="txtfile" value="#" />
What I want to do is make it so I can replace a character in the document, such as the letter "a",for as many times as it occurs, for a random character from the array, and do that for each character found (like replacing "a" for "t", "b" for "4", so on and so forth). Is this possible without changing my script completely or making it too long?

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic