Skip to content

Instantly share code, notes, and snippets.

@TomoG29
Created June 1, 2020 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomoG29/6be14fe9e70bfec903e2eb1029d8e0d0 to your computer and use it in GitHub Desktop.
Save TomoG29/6be14fe9e70bfec903e2eb1029d8e0d0 to your computer and use it in GitHub Desktop.
<div class="box">
<p id="res" class="res">まだクリック無し!</p>
<div class="btn-square">
<p id="btn">ボタン</p>
</div>
</div>
<script>// <![CDATA[
var Value = 0;
document.getElementById("btn").onclick = function() {
var str = Value + '回目のクリック';
document.getElementById("res").innerHTML = str;
Value++;
};
// ]]></script>
<style><!--
.btn-square {
display: inline-block;
padding: 0.5em 1em;
text-decoration: none;
background: #668ad8;/*ボタン色*/
color: #FFF;
border-bottom: solid 4px #627295;
border-radius: 3px;
}
.btn-square:active {
/*ボタンを押したとき*/
-webkit-transform: translateY(4px);
transform: translateY(4px);/*下に動く*/
border-bottom: none;/*線を消す*/
}
.res {
color: #000000;
}
.box {
display: inline-block;
padding: 0.5em 1em;
text-decoration: none;
color: #67c5ff;
border: double 4px #67c5ff;
border-radius: 3px;
transition: .4s;
}
--></style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment