Ojimin
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTR-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HomePurchaseAgePrediction</title>
<link rel="stylesheet" href="css/style2.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;500;700;900&display=swap"
rel="stylesheet"
/>
</head>
<body>
<nav>
<h1 onClick="location.href='/'">Home Purchase Age Prediction</h1>
</nav>
<main>
<div id="info"></div>
<div id="home_info">
<div id="map"></div>
<ul>
<div>LIST</div>
<li></i>아파트 목록을 가져옵니다.</li>
<li></i>아파트 목록을 가져옵니다.</li>
<li></i>아파트 목록을 가져옵니다.</li>
<li></i>아파트 목록을 가져옵니다.</li>
<li></i>아파트 목록을 가져옵니다.</li>
</ul>
</div>
</main>
<script
type="text/javascript"
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=17cbb7795b615d8f1f0595f972e26c0f&libraries=services,clusterer,drawing"
></script>
<script type="text/javascript" src="../js/next_page.js"></script>
</body>
</html>
<head>
<meta charset="UTR-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>HomePurchaseAgePrediction</title>
<link rel="stylesheet" href="css/style2.css" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;500;700;900&display=swap"
rel="stylesheet" />
</head>
<body>
<nav>
<h1 onClick="location.href='/'">Home Purchase Age Prediction</h1>
</nav>
<main>
<div id="info"></div>
<div id="home_info">
<div id="map"></div>
<ul id="house_list">
<div>LIST</div>
</ul>
</div>
</main>
<script type="text/javascript"
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=17cbb7795b615d8f1f0595f972e26c0f&libraries=services,clusterer,drawing"></script>
<script type="text/javascript" src="../js/next_page.js"></script>
</body>
</html>
\ No newline at end of file
......
......@@ -13,7 +13,7 @@ function resizeMap() {
Container.style.width = "400px";
Container.style.height = "300px";
}
function relayout() {
map.relayout();
}
......@@ -81,21 +81,48 @@ function displayMarker(Position) {
});
map.setCenter(Position);
function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return "";
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function getParameterByName(name, url = window.location.href) {
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return "";
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
//가격리스트로 year계산
var priceList = [2000, 3000, 4000, 5000]; //임시로 넣어뒀습니다.
function yearCalc() {
var sum = 0;
for (var i = 0; i < priceList.length; i++) {
sum = sum + priceList[i];
}
var meanPrice = sum / priceList.length;
var saveInyear = (Number(salary) - Number(expenditure)) * 12;
return Math.ceil(meanPrice / saveInyear);
}
//다음 페이지에서 입력값 받아오기
var salary = getParameterByName("salary");
var expenditure = getParameterByName("expenditure");
var year = "3"; //값 받아오기 전 기본값으로 설정
var div = document.getElementById("info");
div.innerText = `${salary}만원의 월급과 ${expenditure}만원의 지출을 유지하면 당신은 ${year}년 후 아래의 집을 구매할 수 있습니다.`;
//다음 페이지에서 입력값 받아오기
var salary = getParameterByName("salary");
var expenditure = getParameterByName("expenditure");
var year = yearCalc();
var div = document.getElementById("info");
connection.end();
//20년을 초과한 결과값이 나올 때 20 + α 로 표시합니다.
if (year > 20) {
year = "20 + α ";
}
div.innerText = `${salary}만원의 월급과 ${expenditure}만원의 지출을 유지하면 당신은 ${year}년 후 아래의 집을 구매할 수 있습니다.`;
//주소 받아오기
var dataFromServer = ["xx동 xx", "xx", "00동 00"]; //임시로 넣어뒀습니다.
//next page li 요소 추가
for (var i = 0; i < dataFromServer.length; i++) {
const li = document.createElement("li");
const textNode = document.createTextNode(dataFromServer[i]);
li.appendChild(textNode);
document.getElementById("house_list").appendChild(li);
}
\ No newline at end of file
......