Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

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

              
                <header><h1>パスワード自動生成</h1></header>
<div id="conf">
  <dl>
    <dt>パスワードの文字数</dt>
    <dd><input type="text" id="len" size="2" maxlength="2" value="8">文字</dd>
  </dl>
  <dl>
    <dt>文字種</dt>
    <dd><input type="checkbox" id="al" checked="checked">英字(大文字)<br>
      <input type="checkbox" id="as" checked="checked">英字(小文字)<br>
      <input type="checkbox" id="int" checked="checked">数字<br>
      <input type="checkbox" id="mark">記号</dd>
  </dl>
  <button id="submit">パスワード生成</button>
</div>
<div id="result"></div>
<footer>powered by <a href="http://aplicot.jp/" target="_blank">aplicot</a></footer>
              
            
!

CSS

              
                html, body {
  margin: 0;
  padding: 0;
}
* {
  box-sizing: border-box;
}
h1 {
  margin: 0;
  padding: 0;
  font-size: 21px;
  font-weight: normal;
}
button {
  width: 100%;
  padding: .5em;
  bottom: 10px;
}
header{
  width: 100%;
  height: 50px;
  padding: 10px;
  background: #82b515;
  color: #fff;
}
footer {
  width: 100%;
  height: 50px;
  padding: 10px;
  background: #000;
  color: #fff;
}
footer a {
  color: #fff;
}
#conf{
  position: relative;
  display: table-cell;
  width: 40%;
  padding: 10px;
  background: #ccc;
}
#conf p {
  font-size: 12px;
  line-height: 1.8em;
}
#result {
  display: table-cell;
  width: 60%;
  padding: 10px;
}
input[type="text"].pass{
  margin: 5px;
  font-size: 21px;
}
              
            
!

JS

              
                var chars = '';
var html = '';
$(function(){
  $('#submit').click(function(){
    chars = conf();
    html = '';
    html = submit();
    $('#result').html(html);
  });
  chars = conf();
  html = submit();
  $('#result').html(html);

  function conf() {
    chars = '';
    if ($('#al').prop("checked")) {
      chars += 'ABCDEFGHIJLKMNOPQRSTUVWXYZ';
    }
    if ($('#as').prop("checked")) {
      chars += 'abcdefghijlkmnopqrstuvwxyz';
    }
    if ($('#int').prop("checked")) {
      chars += '0123456789';
    }
    if ($('#mark').prop("checked")) {
      chars += '+-*,./|!#~$%&()';
    }
    return chars;
  }
  
  function submit() {
    for(var i=0; i<8; i++) {
      html += makePass();
    }
    return html;
  }
  
  function makePass() {
    var clen = chars.length;
    var r = "";
    for(var i=0; i<$('#len').val(); i++){
      r += chars[Math.floor(Math.random()*clen)];
    }
    return '<input type="text" class="pass" value="'+r+'">';
  }
});
              
            
!
999px

Console