Last active
April 23, 2020 22:36
-
-
Save oha-yashi/3979da0b9ef14dabe4e4255c341a983e to your computer and use it in GitHub Desktop.
localhosttest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title> | |
ろ〜かるほすとてすと | |
</title> | |
</head> | |
<body> | |
<h1>welcome to <span id="titlespace"></span></h1> | |
<button id="getohabutton">get oha.txt</button> | |
<p>上のボタンを押すと下に<code>oha.txt</code>の内容がでる</p> | |
<p id="status"></p> | |
<p id="result"></p> | |
<pre id="ohaspace"></pre> | |
<script src="main.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const titlespace = document.getElementById("titlespace"); | |
titlespace.textContent = document.title; | |
const getohabutton = document.getElementById("getohabutton"); | |
const status = document.getElementById("status"); | |
const result = document.getElementById("result"); | |
const ohaspace = document.getElementById("ohaspace"); | |
getohabutton.onclick = function(){ | |
status.textContent = "クリックされました" | |
var url = "oha.txt" | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", url); | |
xhr.responseType = "text"; | |
xhr.onload = function(){ | |
result.textContent = "読み込みました↓↓↓" | |
ohaspace.textContent = xhr.response; | |
} | |
xhr.send(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
おは〜〜〜☀︎ | |
読み込めましたか? | |
めでたし。 | |
🤗🤗🤗🤗🤗 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment