Toggle navigation
Toggle navigation
This project
Loading...
Sign in
LI WENHAO
/
kartrider
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김명주
2021-11-07 16:01:07 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c87cc1d75e9856cfb49d4fa5926050ae6977bf29
c87cc1d7
1 parent
9a821e58
Create game and Connect homepage
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
5 deletions
inf_search.js
views/game_home.ejs
views/image/background.png
views/inf_search_home.ejs
views/main_home.html → views/main_home.ejs
inf_search.js
View file @
c87cc1d
...
...
@@ -6,11 +6,13 @@ const bodyParser=require('body-parser');
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
false
}));
// URL 인코딩 안함
app
.
use
(
bodyParser
.
json
());
// json 타입으로 파싱하게 설정
app
.
use
(
'/inf/result'
,
express
.
static
(
'metadata'
));
app
.
use
(
'/'
,
express
.
static
(
'views'
));
app
.
set
(
'views'
,
__dirname
+
'/views'
);
app
.
set
(
'view engine'
,
'ejs'
);
var
chname
;
var
vec
=
[];
app
.
post
(
"/inf/result"
,(
req
,
res
)
=>
{
chname
=
encodeURIComponent
(
req
.
body
.
test
);
});
...
...
@@ -63,11 +65,21 @@ app.get("/inf/result",(req,res)=>{
}
});
});
app
.
post
(
"/game"
,(
req
,
res
)
=>
{
vec
.
push
(
req
.
body
.
test
);
console
.
log
(
vec
);
})
app
.
get
(
"/game"
,(
req
,
res
)
=>
{
res
.
render
(
'game_home'
);
})
app
.
get
(
"/inf"
,(
req
,
res
)
=>
{
res
.
render
(
'inf_search_home'
);
});
app
.
get
(
"/"
,(
req
,
res
)
=>
{
res
.
render
(
'main_home'
);
});
app
.
listen
(
"8080"
,
function
(
req
,
res
){
console
.
log
(
'server listening at port no. 8080'
);
});
...
...
views/game_home.ejs
0 → 100644
View file @
c87cc1d
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<script
src=
"http://code.jquery.com/jquery-1.11.3.min.js"
></script>
<script
src=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"
></script>
</head>
<body>
<script
language=
"JavaScript"
>
function
Ajax
(
index
){
$
.
ajax
({
url
:
'/game'
,
// postTest 주소로
async
:
true
,
// 동기화 - 서버에서 반응이 올때까지 기다림
type
:
'POST'
,
// POST 방식으로
data
:
{
test
:
index
// 텍스트필드에 입력한 값을 test라는 이름으로 보냄
},
dataType
:
'json'
});
}
function
Change
(
num
)
{
if
(
num
==
1
){
document
.
getElementById
(
"btn1"
).
innerText
=
"선택지1-1"
;
document
.
getElementById
(
"btn2"
).
innerText
=
"선택지2-1"
;
Ajax
(
1
);
}
else
{
document
.
getElementById
(
"btn1"
).
innerText
=
"선택지1-1"
;
document
.
getElementById
(
"btn2"
).
innerText
=
"선택지2-1"
;
Ajax
(
2
);
}
/*
var a=document.getElementById("btn").innerText;
if(a=="뭘보냐"){
document.getElementById("btn1").innerText="선택지1-1";
document.getElementById("btn2").innerText="선택지1-1";
Ajax(1);
}
else if(a=="안봤는데?"){
document.getElementById("btn1").innerText="선택지1-2";
Ajax(2);
}
else if(a=="본거다안다"){
document.getElementById("btn2").innerText="선택지1-3";
Ajax(3);
}*/
}
</script>
<button
id=
"btn1"
onclick=
"Change(1)"
>
선택지 1
</button>
<button
id=
"btn2"
onclick=
"Change(2)"
>
선택지 2
</button>
</body>
</html>
\ No newline at end of file
views/image/background.png
deleted
100644 → 0
View file @
9a821e5
12.5 KB
views/inf_search_home.ejs
View file @
c87cc1d
<html>
<head>
<title>
TESTESTEST
</title>
<script
src=
"http://code.jquery.com/jquery-1.11.3.min.js"
></script>
<script
src=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"
></script>
</head>
...
...
views/main_home.
html
→
views/main_home.
ejs
View file @
c87cc1d
...
...
@@ -8,8 +8,8 @@
<img
id=
"logo"
src=
"image/logo.png"
>
<A
href=
"https://kart.nexon.com/Main/Index.aspx"
target=
"_blank"
>
공식 홈페이지 바로가기
</A>
<div
id=
"div1"
>
<button
id=
"btn1"
>
<img
src=
"image/btn1.png"
></button>
<button
id=
"btn2"
>
<img
src=
"image/btn2.png"
></button>
<button
id=
"btn1"
onClick=
"location.href='game'"
>
<img
src=
"image/btn1.png"
></button>
<button
id=
"btn2"
onClick=
"location.href='inf'"
>
<img
src=
"image/btn2.png"
></button>
</div>
</body>
...
...
Please
register
or
login
to post a comment