Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <form name="names">
  <input type="text" id="box1" name="firstlastname" placeholder="Luke Skywalker"><br>
  <input type="text" id="box3" name="domain" placeholder="disney.com"><br>
  <input type="text" id="box2" name="sep" placeholder="Optional: custom separator"><br>
  <input type="submit" id="button-make" value="Make Variations" onClick="permutate(this.form);return false;">
</form>

<input type="submit" id="button-reset" value="Reset" onClick="reset('results');return false;">

<div id="results"></div>


              
            
!

CSS

              
                #form{
  margin-top: 20px;
}

input[type]{
  font-size: 25px;
  font-family: arial;
}

#box1, #box2, #box3{
  width: 317px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid rgb(200,200,200);
  border-top-color: rgb(100,100,100);
  border-radius: 5px;
  color: #5A5A5A;
}

#button-reset{
  position:relative;
  display:inline-block;
}

#button-make, #button-reset{
  float:left;
}

#button-reset{
  margin: 0 0 0 10px;
}

#results{
  position: relative;
  display: block;
  overflow: auto;
  margin-top: 45px;
  padding: 15px;
  border: 1px solid rgb(200,200,200);
  /*border-bottom: 1px solid rgb(200,200,200);*/
  background: rgb(245,245,245);
  color: rgb(50,50,50);
  font-size: 20px;
  line-height: 36px;
  font-family: arial;
}
              
            
!

JS

              
                function permutate(form) {

  var firstlastname = form.firstlastname.value.toLowerCase().trim();
  var namesplit = firstlastname.split(" ");
  var firstname = namesplit[0];
  var lastname = namesplit[1];
  var domain = form.domain.value.toLowerCase().trim();
  var sep = form.sep.value + ' ';
  //var sep = ", ";
  
  if (firstname==null || firstname==""){
    document.getElementById("results").innerHTML= "Please provide a first name e.g. Luke";
    return false;    
  } else if (lastname==null || lastname==""){
    document.getElementById("results").innerHTML= "Please provide a last name e.g. Skywalker";
    return false;    
  } else if (domain==null || domain==""){
    document.getElementById("results").innerHTML= "Please provide a domain e.g. yahoo.com";
    return false;
  } else {}
  
  //If no optional separator, defult to comma
  if (sep==null || sep==" "){
    sep = ", ";
  }
  
  //bob@domain.com
  var p1 = firstname + "@" + domain + sep;
  
  //bobsmith@domain.com
  var p2 = firstname + lastname + "@" + domain + sep;
  
  //bob.smith@domain.com
  var p3 = firstname + "." + lastname + "@" + domain + sep;
  
  //smith@domain.com
  var p4 = lastname + "@" + domain + sep;
  
  //bsmith@domain.com
  var p5 = firstname.charAt(0) + lastname + "@" + domain + sep;

  //b.smith@domain.com
  var p6 = firstname.charAt(0) + "." + lastname + "@" + domain + sep;
  
  //bobs@domain.com
  var p7 = firstname + lastname.charAt(0) + "@" + domain + sep;
  
  //bob.s@domain.com
  var p8 = firstname + "." + lastname.charAt(0) + "@" + domain + sep;
  
  //bs@domain.com
  var p9 = firstname.charAt(0) + lastname.charAt(0) + "@" + domain;
  
  var addresses= p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;
  
	document.getElementById("results").innerHTML= addresses;
}

function reset(results) {
  document.getElementById("results").innerHTML= "";
  document.getElementById("box1").value = "";
  document.getElementById("box3").value = "";
  document.getElementById("box2").value = "";
}
              
            
!
999px

Console