Last active
March 12, 2019 07:09
-
-
Save hw0k/d6738d59be8328b2e051df500b62256e to your computer and use it in GitHub Desktop.
190312 Web Programming Homework
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 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