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

              
                <label>
	<input class="js-check" type="radio" name="rs" value="1" onclick="formSwitch()" >特にない
</label>

<label>
  <input class="js-check" type="radio" name="rs" value="1" onclick="formSwitch()">好きな音楽のジャンル
</label>

<span id="sample">
  
<div class="selecter">
  <select id="changeSelect" name="hoge" onchange="entryChange2();">
    <option value="select1">ジャンルを選んでください</option>
    <option value="select2">ロック</option>
    <option value="select3">ジャズ</option>
    <option value="select4">ポップス</option>
    <option value="select5">クラシック</option>
    <option value="select6">ラテン</option>
   </select>
</div>
  
</span>

<div id="Box">
  <p>『ロック』の発祥は1950年代と言われています。アメリカに奴隷として連れてこられた黒人たちのアフリカ系黒人音楽が起源らしいです。</p>
</div>

<div id="Box2">
  <p>『ジャズ』は、19世紀末から20世紀初頭にかけて、アメリカのニューオリーンズで西洋楽器を用いたヨーロッパ音楽の技術と独特なリズムの黒人音楽が融合したことにより生まれたとされます。</p>
</div>

<div id="Box3">
  <p>『ポップス』は1950〜60年代に西洋でロックの派生として現代的形態で始まったポピュラー音楽です。</p>
</div>

<div id="Box4">
  <p>『クラシック』の語源はラテン語のクラスにあり、直訳すると「古典音楽」です。一流・最高という意味もあります。</p>
</div>

<div id="Box5">
  <p>『ラテン』は、中南米発祥の音楽の総称で中南米とカリブ海地域のラテン系の民族音楽のことを言います。</p>
</div>
              
            
!

CSS

              
                .selecter select {
  /* styling */
  background-color: white;
  border: thin solid #E5E5E5;
  border-radius: 4px;
  display: inline-block;
  font: inherit;
  line-height: 1.5em;
  padding: 0.5em 3.5em 0.5em 1em;
  cursor: pointer;
  /* reset */
  margin: 0;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, white 50%), linear-gradient(135deg, white 50%, transparent 50%), linear-gradient(to right, #E07581, #E07581);
  background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 15px) calc(1em + 2px), 100% 0;
  background-size: 5px 5px, 5px 5px, 2.5em 2.5em;
  background-repeat: no-repeat;
}

.c-selecter select:focus {
  background-image: linear-gradient(45deg, white 50%, transparent 50%), linear-gradient(135deg, transparent 50%, white 50%), linear-gradient(to right, gray, gray);
  background-position: calc(100% - 15px) 1em, calc(100% - 20px) 1em, 100% 0;
  background-size: 5px 5px, 5px 5px, 2.5em 2.5em;
  background-repeat: no-repeat;
  border-color: grey;
  outline: 0;
}

.js-check{
  margin-bottom:15px
}
              
            
!

JS

              
                var selecterBox = document.getElementById('sample');
var selecter = document.getElementById('changeSelect');
var item1 = document.getElementById('Box');
var item2 = document.getElementById('Box2');
var item3 = document.getElementById('Box3');
var item4 = document.getElementById('Box4');
var item5 = document.getElementById('Box5');
selecterBox.style.display = "none";
item1.style.display = "none";
item2.style.display = "none";
item3.style.display = "none";
item4.style.display = "none";
item5.style.display = "none";

    function formSwitch() {
        check = document.getElementsByClassName('js-check')
        if (check[0].checked) {
            selecterBox.style.display = "none";
            item1.style.display = "none";
            item2.style.display = "none";
            item3.style.display = "none";
            item4.style.display = "none";
            item5.style.display = "none";
            selecter.selectedIndex = 0;

        } else if (check[1].checked) {
            selecterBox.style.display = "block";

        } else {
            selecterBox.style.display = "none";
        }
    }
    window.addEventListener('load', formSwitch());

function entryChange2(){
    if(document.getElementById('changeSelect')){
    id = document.getElementById('changeSelect').value;

    if(id == 'select2'){
        item1.style.display = "block";
        item2.style.display = "none";
        item3.style.display = "none";
        item4.style.display = "none";
        item5.style.display = "none";
    }
    else if(id == 'select3'){
        item1.style.display = "none";
        item2.style.display = "block";
        item3.style.display = "none";
        item4.style.display = "none";
        item5.style.display = "none";
    }
    else if(id == 'select4'){
        item1.style.display = "none";
        item2.style.display = "none";
        item3.style.display = "block";
        item4.style.display = "none";
        item5.style.display = "none";
    }
    else if(id == 'select5'){
        item1.style.display = "none";
        item2.style.display = "none";
        item3.style.display = "none";
        item4.style.display = "block";
        item5.style.display = "none";
    }
     else if(id == 'select6'){
        item1.style.display = "none";
        item2.style.display = "none";
        item3.style.display = "none";
        item4.style.display = "none";
        item5.style.display = "block";
    }
    else{
        item1.style.display = "none";
        item2.style.display = "none";
        item3.style.display = "none";
        item4.style.display = "none";
        item5.style.display = "none";
    }
}
}
              
            
!
999px

Console