Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2017-1-WebServiceProgramming
/
Practice-Materials
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
신수용
2017-04-04 14:57:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9d0a83eefa061e79985c6c9716c71eb5102d950a
9d0a83ee
1 parent
1a0748a4
수정
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
1 deletions
09_JavaScript/01_hello.js
09_JavaScript/04_구구단.html
09_JavaScript/test.html
09_JavaScript/01_hello.js
View file @
9d0a83e
"use strict"
;
console
.
log
(
"Hello, World"
);
document
.
write
(
"Hello, World"
)
...
...
09_JavaScript/04_구구단.html
0 → 100644
View file @
9d0a83e
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"UTF-8"
>
<title>
Insert title here
</title>
<script
type=
"text/javascript"
>
window
.
onload
=
function
()
{
document
.
getElementById
(
"sel"
).
onchange
=
function
()
{
//sel = document.getElementById('frm').get
sel
=
frm
.
sel
.
options
[
frm
.
sel
.
selectedIndex
].
value
;
//select의 선택한 value값을 출력
dansu
=
frm
.
sel
.
options
[
frm
.
sel
.
selectedIndex
].
text
;
//select의 선택한 택스트를 출력
alert
(
sel
);
// 몇 단인지 뿌려주는 부분-----------------------------------
var
th
=
document
.
createElement
(
"th"
);
var
text
=
document
.
createTextNode
(
dansu
);
th
.
appendChild
(
text
);
document
.
getElementById
(
"myTbody"
).
appendChild
(
th
);
// 몇 단인지 뿌려주는 부분-----------------------------------
for
(
i
=
1
;
i
<=
9
;
i
++
)
{
addRow
(
sel
,
i
);
}
}
document
.
getElementById
(
"btnCle"
).
onclick
=
function
()
{
var
re
=
document
.
getElementById
(
"myTbody"
);
while
(
re
.
hasChildNodes
())
{
re
.
removeChild
(
re
.
childNodes
[
0
]);
}
}
}
function
addRow
(
dan
,
dansu
)
{
var
row
=
document
.
createElement
(
"tr"
);
var
col
=
addCol
(
sel
,
i
);
row
.
appendChild
(
col
);
document
.
getElementById
(
"myTbody"
).
appendChild
(
row
);
}
function
addCol
(
dan
,
i
)
{
//alert(i);
var
col
=
document
.
createElement
(
"td"
);
var
text
=
document
.
createTextNode
(
sel
+
" * "
+
i
+
" = "
+
(
sel
*
i
));
col
.
appendChild
(
text
);
return
col
;
}
</script>
</head>
<body>
<h2>
** 구구단 출력 **
</h2>
<form
action=
"#"
name=
"frm"
>
단 :
<select
name=
"sel"
id=
"sel"
>
<option
value=
""
>
선택
</option>
<option
value=
"1"
>
1단
</option>
<option
value=
"2"
>
2단
</option>
<option
value=
"3"
>
3단
</option>
<option
value=
"4"
>
4단
</option>
<option
value=
"5"
>
5단
</option>
<option
value=
"6"
>
6단
</option>
<option
value=
"7"
>
7단
</option>
<option
value=
"8"
>
8단
</option>
<option
value=
"9"
>
9단
</option>
</select>
<input
type=
"button"
id=
"btnCle"
value=
"삭제"
/>
</form>
<br/>
<span
id=
"header"
></span>
<table
id =
"myTable"
>
<tbody
id=
"myTbody"
></tbody>
</table>
</body>
</html>
\ No newline at end of file
09_JavaScript/test.html
View file @
9d0a83e
...
...
@@ -4,7 +4,7 @@
<body>
<script
type=
"text/javascript"
src=
"0
3_sor
t.js"
>
<script
type=
"text/javascript"
src=
"0
4_inpu
t.js"
>
</script>
</body>
...
...
Please
register
or
login
to post a comment