cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <h1>Inspired by "Egbgfa Aadbafbage" by Eegad!</h1>
<input type="text" id="inputString" />
<br /><br/>
<input type="button" value="Generate Musical Cryptogram" onclick="PrintCryptogram()" />
<br/><br />
Output: <span id="outputString"></span>
              //  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 

function PrintCryptogram() {
    var inputStr = document.getElementById('inputString');
    var outputStr = document.getElementById('outputString');

    outputStr.innerHTML = Encipher(inputStr.value);

function Encipher(stringToEncipher) {
    var cryptogram = '';
    // Substitute for the ciphered letter.
    cryptogram = stringToEncipher
      .replace(/h|o|v/g, 'a').replace(/H|O|V/g, 'A')
      .replace(/i|p|w/g, 'b').replace(/I|P|W/g, 'B')
      .replace(/j|q|x/g, 'c').replace(/J|Q|X/g, 'C')
      .replace(/k|r|y/g, 'd').replace(/K|R|Y/g, 'D')
      .replace(/l|s|z/g, 'e').replace(/L|S|Z/g, 'E')
      .replace(/m|t/g, 'f').replace(/M|T/g, 'F')
      .replace(/n|u/g, 'g').replace(/N|U/g, 'G');

    return cryptogram.toString();
Loading ..................