Jump to content
xisto Community
icss21

Morse Code haha

Recommended Posts

very useful :) you know why...

<A></A><P align=left><!-- saved from url=(0034)http://http://www.mathsking.net/morse.htm --><META content="MSHTML 6.00.2800.1106" name=GENERATOR><META content=FrontPage.Editor.Document name=ProgId><script language=JavaScript>var respecterCasse = true;var ignorerCasse = false;var motsEntiers = true;var touteSousChaine = false;function rechercher(cible,terme,respecterCasse,motSeulement) {  var ind = 0;  var suivant = 0;  if (!respecterCasse) {	terme = terme.toLowerCase();	cible = cible.toLowerCase();  }  while ((ind = cible.indexOf(terme,suivant)) >= 0) {	if (motSeulement) {	  var avant = ind - 1;	  var apres = ind + terme.length;	  if (!(espace(cible.charAt(avant)) && espace(cible.charAt(apres)))) {		suivant = ind + terme.length;		continue;	  }	}	return true;  }  return false;}function remplacer(cible, ancienTerme,nouveauTerme,respecterCasse,motSeulement) {  var travail = cible;  var ind = 0;  var suivant = 0;  if (!respecterCasse) {	ancienTerme = ancienTerme.toLowerCase();	travail = cible.toLowerCase();  }  while ((ind = travail.indexOf(ancienTerme,suivant)) >= 0) {	if (motSeulement) {	  var avant = ind - 1;	  var apres = ind + ancienTerme.length;	  if (!(espace(travail.charAt(avant)) && espace(travail.charAt(apres)))) {		suivant = ind + ancienTerme.length;		continue;	  }	}	cible = cible.substring(0,ind) + nouveauTerme + cible.substring(ind+ancienTerme.length,cible.length);	travail = travail.substring(0,ind) + nouveauTerme + travail.substring(ind+ancienTerme.length,travail.length);	suivant = ind + nouveauTerme.length;	if (suivant >= travail.length) { break; }  }  return cible;}function espace(check) {  var espace = " ,/<>?!`';:%^&()=|{}" + '"' + "\\\n\t";  for (var i = 0; i < espace.length; i++)	if (check == espace.charAt(i)) { return true; }     if (check == "") { return true; }  if (check == null) { return true; }  return false;}// STOP HIDING -->function creerMatrice(num) {  for (var i=1; i <= num; i++)	this[i] = "";  this.length = num;}var MORSE = new creerMatrice(26+6);var AVIATION = new creerMatrice(26+6);MORSE[01] = ".-"MORSE[02] = "-..." MORSE[03] = "-.-."MORSE[04] = "-.."MORSE[05] = "."MORSE[06] = "..-."MORSE[07] = "--."MORSE[08] = "...."MORSE[09] = ".."MORSE[10] = ".---"MORSE[11] = "-.-"MORSE[12] = ".-.."MORSE[13] = "--"MORSE[14] = "-."MORSE[15] = "---"MORSE[16] = ".--."MORSE[17] = "--.-"MORSE[18] = ".-."MORSE[19] = "..."MORSE[20] = "-"MORSE[21] = "..-"MORSE[22] = "...-"MORSE[23] = ".--"MORSE[24] = "-..-"MORSE[25] = "-.--"MORSE[26] = "--.."MORSE[27] = "-.-.."MORSE[28] = "--.-."MORSE[29] = "----"MORSE[30] = ".---."MORSE[31] = "...-."MORSE[32] = "..--"CARACTERES = "ABCDEFGHIJKLMNOPQRSTUVWXYZ[@*]$#"function CODE(LETTRE){if(LETTRE == " "){return " " }for(tg=0; tg<=26+6; tg++) {var LT = CARACTERES.charAt(tg)if(LT == LETTRE){return MORSE[tg +1] }}return ""}function GO() {var text = document.forms[0].valeur.valuetext = text.toUpperCase()var MSG = ""var LTR = ""NUM = text.lengthfor(t = 0; t <= NUM-1; t++){if (text.charAt(t) == '^') { LTR = text.charAt(++t) switch (LTR) {  case 'C': case 'c': LTR = "["; break;  case 'G': case 'g': LTR = "@"; break;  case 'H': case 'h': LTR = "*"; break;  case 'J': case 'j': LTR = "]"; break;  case 'S': case 's': LTR = "$"; break;  case 'U': case 'u': LTR = "#"; break; }} else { LTR = text.charAt(t)}MSG = MSG + ( CODE(LTR) + " ");}document.forms[0].OUTPUT.value = MSG}function UNGO(){var text = document.forms[0].OUTPUT.valuetext = text.toUpperCase()var MSG = text + " "for(th=0;th<=25+6;th++){AA = MORSE[th +1]BB = CARACTERES.charAt(th)MSG = remplacer(MSG,AA,BB,false, true)}MSG = remplacer(MSG,"  ","%")MSG = remplacer(MSG," ","")MSG = remplacer(MSG,"%"," ")document.forms[0].valeur.value = MSG}   </SCRIPT><B><I><FONT face="Comic Sans MS" size=4>MORSE</FONT></I></B><BR></P><TABLE height=152 cols=1 width="100%" border=0><TBODY><TR><TD height=1><FORM name=entree></TD></TR><TR><TD height=18><B><FONT face=Fixedsys size=4>alphabet:</FONT></B></TD></TR><TR><TD height=25><INPUT style="WIDTH: 377px; HEIGHT: 21px" size=50 name=valeur>  <INPUT onclick=GO() type=button size=15 value=translate to morse name=ok></TD></TR><TR><TD height=19><B><FONT face=Fixedsys size=4>morse code:</FONT></B></TD></TR><TR><TD height=25><INPUT style="WIDTH: 377px; HEIGHT: 21px" size=52 name=OUTPUT>  <INPUT onclick=UNGO() type=button size=15 value=translate to alphabet name=decode></TD></TR></TBODY></TABLE><BR><INPUT type=reset value=delete><BR></FORM>

Share this post


Link to post
Share on other sites

its eh...translation tool,the morse codesee here:MORSE[01] = ".-"MORSE[02] = "-..."MORSE[03] = "-.-."MORSE[04] = "-.."MORSE[05] = "."MORSE[06] = "..-."MORSE[07] = "--."MORSE[08] = "...."MORSE[09] = ".."MORSE[10] = ".---"MORSE[11] = "-.-"MORSE[12] = ".-.."MORSE[13] = "--"MORSE[14] = "-."MORSE[15] = "---"MORSE[16] = ".--."MORSE[17] = "--.-"MORSE[18] = ".-."MORSE[19] = "..."MORSE[20] = "-"MORSE[21] = "..-"MORSE[22] = "...-"MORSE[23] = ".--"MORSE[24] = "-..-"MORSE[25] = "-.--"MORSE[26] = "--.."MORSE[27] = "-.-.."MORSE[28] = "--.-."MORSE[29] = "----"MORSE[30] = ".---."MORSE[31] = "...-."MORSE[32] = "..--"just have the type-words change into these symbols,and also change back

Edited by icss21 (see edit history)

Share this post


Link to post
Share on other sites

Thanks, but explain it better.What do i have to do, just insert it in a html page, or what?Please give more information, it sounds very usefull and interesting, but i need to now more before i do anything else.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.