Skip to content

Commit

Permalink
最初のコミット
Browse files Browse the repository at this point in the history
  • Loading branch information
gmrockman committed Apr 4, 2019
0 parents commit 6c84e39
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#main {
width: 500px;
margin: 0 auto;
position: relative;
}

h1 {
text-align: center;
}
Binary file added images/default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>イメージを表示</title>
<link rel="stylesheet" href="default.css">
</head>
<body>
<div id="main">
<h1>今日のイメージ</h1>
<img id="myImage" width="500" height="333" src="images/default.jpg">
</div>
<script src="./js/sample.js"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions js/sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var images = ["img0.jpg", "img1.jpg", "img2.jpg",
"img3.jpg"];
// イメージをランダムに取り出す
var tImg = images[Math.floor(Math.random() * 4)];
// イメージエレメントを取得
var myImage = document.getElementById("myImage");
// src属性にイメージを設定
myImage.src = "images/" + tImg;

0 comments on commit 6c84e39

Please sign in to comment.