Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marutyan committed Aug 12, 2024
0 parents commit f0edd8c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="style.css" />
<title>練習</title>
</head>
<body>
<p>ようこそ<span id="name">テスト</span>さん!</p>
<p>あなたの運勢は<span id="result">大吉</span>です!</p>
<img src="omikuji.png">
<script type="text/javascript" src="omikuji.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions omikuji.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
let username;
let userresult;

username = prompt("お名前を教えて下さい。");
if (username == "") {
username = "名無し";
}
document.getElementById("name").innerHTML = username;

let rand = Math.floor(Math.random() * 5);

if (rand == 0) {
userresult = "大吉";
}
if (rand == 1) {
userresult = "中吉";
}
if (rand == 2) {
userresult = "小吉";
}
if (rand == 3) {
userresult = "吉";
}
if (rand == 4) {
userresult = "凶";
}
document.getElementById("result").innerHTML = userresult;
Binary file added omikuji.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
img {
height: 100px;
}#name {
color: blue;
}

#result {
color: green;
}

0 comments on commit f0edd8c

Please sign in to comment.