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

              
                <div id="app">
    <select id="datelist" name="datelist">
        <option value="">---選択してください---</option>
    </select>
</div>

              
            
!

CSS

              
                #app {
    width: 96%;
    max-width: 500px;
    margin: 40px auto;
    padding: 20px;
    padding: 28px;
    border: 1px solid #ffffff;
    border-radius: 5px;
    background-color: transparent;
    box-shadow: 2px 2px 5px 0px rgba(200, 200, 200, 1);
    font-family: "Times New Roman";
}
              
            
!

JS

              
                //日本の曜日配列
const week = ['日', '月', '火', '水', '木', '金', '土']
//セレクトボックスを取得
const datelist = document.getElementById('datelist')
const end = 7

if(end !== undefined){

    for(let i = 0; i < end; i++){
        //取得する日付の値を設定
        let param = Date.now() + i * 86400000
        //値から日付を取得
        let date = new Date(param)
        
        //dateから年を取得
        let y = date.getFullYear()
        //dateから月を取得
        let m = date.getMonth()+1
        //dateから日を取得
        let d = date.getDate()
        //dateから曜日を取得
        let w = date.getDay()
        
        //月を2桁に揃える
        if(m < 10){ m = '0'+m }
        //日を2桁に揃える
        if(d < 10){ d = '0'+d }
        
        //テキストの出力形式
        let textFormat = y+'年'+m+'月'+d+'日'+'('+week[w]+')'
        //値の出力形式
        let valueFormat = y+'-'+m+'-'+d
        
        //option要素を作成
        let option = document.createElement('option')
        //optionのテキストを指定
        option.textContent = textFormat
        //optionの値を指定
        option.value = valueFormat
        //detelistの末尾に追加
        datelist.appendChild(option);
    }
}
              
            
!
999px

Console