Skip to content

Instantly share code, notes, and snippets.

@hw0k
Last active March 12, 2019 07:09
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 hw0k/d6738d59be8328b2e051df500b62256e to your computer and use it in GitHub Desktop.
Save hw0k/d6738d59be8328b2e051df500b62256e to your computer and use it in GitHub Desktop.
190312 Web Programming Homework
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>테스트</title>
</head>
<body>
<form method="get" action="/greeting">
<input type="text" name="say" placeholder="인사말">
<input type="text" name="to" placeholder="이름">
<button>제출</button>
</form>
<div>
<input type="text" id="say" placeholder="인사말">
<input type="text" id="to" placeholder="이름">
<button onclick="send()">제출</button>
</div>
<script>
function send() {
let say = document.getElementById("say").value;
let to = document.getElementById("to").value;
let dest = `http://${location.host}/greeting1`;
if (say != null && say != "") {
dest += `/${say}`;
}
else {
dest += `/hello`;
}
if (to != null && to != "") {
dest += `/${to}`;
}
location.href = dest;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment