retart
12-09-2002, 06:06 PM
It's very simple what i'm trying to do i have downloaded Morse code converter script - By Luke Watson I have changed everything that i want to change but there two things i can't figure out:
1. I can't get it to use spaces or even find that they are there
2. I also want to remove the "EXPLANATION:" part of the script
I have tried to email the creator but his email does not work for reason so i am hoping that someone on here can help i think i have posted enough info on this
Here is the script:
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Start -->
//Morse code converter- By Luke Watson (luke@lukewatson.f2s.com)
//Script featured on JK (http://javascriptkit.com)
//Visit http://javascriptkit.com for this script and more
// Mod by David rittenhouse
var charCodes=new Array(27);
charCodes["a"]="26";
charCodes["b"]="27";
charCodes["c"]="28";
charCodes["d"]="29";
charCodes["e"]="30";
charCodes["f"]="31";
charCodes["g"]="32";
charCodes["h"]="33";
charCodes["i"]="34";
charCodes["j"]="35";
charCodes["k"]="36";
charCodes["l"]="37";
charCodes["m"]="38";
charCodes["n"]="39";
charCodes["o"]="40";
charCodes["p"]="41";
charCodes["q"]="42";
charCodes["r"]="43";
charCodes["s"]="44";
charCodes["t"]="45";
charCodes["u"]="46";
charCodes["v"]="47";
charCodes["w"]="48";
charCodes["x"]="49";
charCodes["y"]="50";
charCodes["z"]="51";
charCodes[" "]="52";
var temp=''
function encode() {
document.morsecode.chars.value=document.morsecode.chars.value.toLowerCase();
document.morsecode.codebox.value="";
temp=''
var chars=document.morsecode.chars.value.split("");
for (a=0; a<chars.length; a++) {
if (chars[a]!=" ") {
if (window.charCodes[chars[a]]) {
document.morsecode.codebox.value+=charCodes[chars[a]];
temp+=chars[a]+"="+charCodes[chars[a]]+"\n";
}
else
temp+=chars[a]+"=(None)\n";
}
else temp+="\n";
}
document.morsecode.codebox.value+="\n\n\nEXPLANATION:\n\n"+temp
}
// -->
</SCRIPT>
Now i belive this is the part i have trouble with:
function encode() {
document.morsecode.chars.value=document.morsecode.chars.value.toLowerCase();
document.morsecode.codebox.value="";
temp=''
var chars=document.morsecode.chars.value.split("");
for (a=0; a<chars.length; a++) {
if (chars[a]!=" ") {
if (window.charCodes[chars[a]]) {
document.morsecode.codebox.value+=charCodes[chars[a]];
temp+=chars[a]+"="+charCodes[chars[a]]+"\n";
}
else
temp+=chars[a]+"=(None)\n";
}
else temp+="\n";
}
document.morsecode.codebox.value+="\n\n\nEXPLANATION:\n\n"+temp
}
what i'm trying to make is a simple encoder for the code i made and i just dont want to have to use find&replace in notepad because it takes to long.
Any Help would great!
David
1. I can't get it to use spaces or even find that they are there
2. I also want to remove the "EXPLANATION:" part of the script
I have tried to email the creator but his email does not work for reason so i am hoping that someone on here can help i think i have posted enough info on this
Here is the script:
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Start -->
//Morse code converter- By Luke Watson (luke@lukewatson.f2s.com)
//Script featured on JK (http://javascriptkit.com)
//Visit http://javascriptkit.com for this script and more
// Mod by David rittenhouse
var charCodes=new Array(27);
charCodes["a"]="26";
charCodes["b"]="27";
charCodes["c"]="28";
charCodes["d"]="29";
charCodes["e"]="30";
charCodes["f"]="31";
charCodes["g"]="32";
charCodes["h"]="33";
charCodes["i"]="34";
charCodes["j"]="35";
charCodes["k"]="36";
charCodes["l"]="37";
charCodes["m"]="38";
charCodes["n"]="39";
charCodes["o"]="40";
charCodes["p"]="41";
charCodes["q"]="42";
charCodes["r"]="43";
charCodes["s"]="44";
charCodes["t"]="45";
charCodes["u"]="46";
charCodes["v"]="47";
charCodes["w"]="48";
charCodes["x"]="49";
charCodes["y"]="50";
charCodes["z"]="51";
charCodes[" "]="52";
var temp=''
function encode() {
document.morsecode.chars.value=document.morsecode.chars.value.toLowerCase();
document.morsecode.codebox.value="";
temp=''
var chars=document.morsecode.chars.value.split("");
for (a=0; a<chars.length; a++) {
if (chars[a]!=" ") {
if (window.charCodes[chars[a]]) {
document.morsecode.codebox.value+=charCodes[chars[a]];
temp+=chars[a]+"="+charCodes[chars[a]]+"\n";
}
else
temp+=chars[a]+"=(None)\n";
}
else temp+="\n";
}
document.morsecode.codebox.value+="\n\n\nEXPLANATION:\n\n"+temp
}
// -->
</SCRIPT>
Now i belive this is the part i have trouble with:
function encode() {
document.morsecode.chars.value=document.morsecode.chars.value.toLowerCase();
document.morsecode.codebox.value="";
temp=''
var chars=document.morsecode.chars.value.split("");
for (a=0; a<chars.length; a++) {
if (chars[a]!=" ") {
if (window.charCodes[chars[a]]) {
document.morsecode.codebox.value+=charCodes[chars[a]];
temp+=chars[a]+"="+charCodes[chars[a]]+"\n";
}
else
temp+=chars[a]+"=(None)\n";
}
else temp+="\n";
}
document.morsecode.codebox.value+="\n\n\nEXPLANATION:\n\n"+temp
}
what i'm trying to make is a simple encoder for the code i made and i just dont want to have to use find&replace in notepad because it takes to long.
Any Help would great!
David