[Day5] HTML 5 [11/8]
* float + ๋๋น 50% ํด๋ ๋ค์ ํ์ผ๋ก ๋์ด๊ฐ๋ ์ด์
-> border์ด 1px ์ฉ ์ก๊ณ ์๊ธฐ ๋๋ฌธ~!
<style>
border : 1px solid gray,
float : left,
width: 50%;
</style>
ํ ๋ฉ๋ด ์ ํ
<style>
ul{
border: 1px solid #e7e7e7;
background-color: #f3f3f3;
list-style-type: none;
padding: 0;
margin: 0;
overflow: hidden;
}
li{
float: left;
}
ul li a{
display: block;
color: #666;
padding: 14px 16px;
text-decoration: none;
text-align: center;
}
ul li a.active{
background-color: #04AA6D;
color: white;
}
li:last-child{
float: right;
}
li:nth-child(4)-> li:last-child{
float: right;
}
ul#main li a:hover:not(active){
background-color: #ddd
}
</style>
<body>
<ul id="main">
<li><a href="#" class="active">Home</a></li>
<li><a href="#">News</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">About</a></li>
</ul>
</body>
<style>
div#demo{
background-color: black;
color: white;
padding: 20px;
}
p:hover{
color: red
}
</style>
<script>
function hide() {
document.gtElementById("demo").style.display="none";
//jquery
$("#btnShow").click(function(){
$("#demo").css("display,"block");
= $("#demo").show();
});
//๋ง์ฝ button ํ๊ทธ์ ์์ด๋๊ฐ ์๋ค๋ฉด?
$("button").click(function (){
// window js๊ฐ์ฒด๋ ์ต์์ ๋ถ๋ชจ ๊ฐ์ฒด์ด๊ธฐ์ ์๋ต๊ฐ๋ฅ
alert("๋ฒํผ ํด๋ฆญ๋จ!");
// button ์ฐพ์์ค๊ธฐ
// $("button:nth-child(1)").click(function(){
// $("button:last-of-type").click(function(){
// $("button").first().click(function (){
// $("button").last().click(function (){
// ์ด๊ฒ๋ window ์๋ต
document.href="์ด๋๊ฒฝ๋ก";
</script>
<body>
<button onclick="hide();">์จ๊ธฐ๊ธฐ</button>
<button onclick id="btnShow">๋ณด์ด๊ธฐ</button>
<div id="demo">
<h2>Lorem</h2>
<p>Lorem ipsum dolor sit amet</p>
<p>Ea error asperiosres</p>
</div>
</body>
layout(๋ฐฐ์น) ๋ฐฉ๋ฒ
1) css float ์์ฑ - ์ง๊ธ
2) css flexbox
3) css ํ๋ ์์ํฌ - ๋ถํธ์คํธ๋ฉ(bootstrap)
4) css ๊ทธ๋ฆฌ๋ ๋ ์ด์์
div(๋ฐฐ์น, layout) + css
id ๊ฐ์ผ๋ก
<style>
*{
box-sizing: border-box;
}
body{
font-family: Arial, Helvetica, sans-serif;
}
div#header{
background-color: #666;
color:white;
padding: 30px;
text-align: center;
font-size: 35px;
}
div#footer{
background-color: #777;
color:white;
padding: 15px;
text-align: center;
font-size: 25px;
}
</style>
<style>
div#nav{
background-color: #ccc;
width: 30%;
height: 300px;
padding: 20px;
float: left;
}
div#nav ul{
/* background-color: red; */
list-style-type: none;
padding: 0;
/* margin: 0; */
}
div#article{
background-color: #f1f1f1;
min-height: 300px;
width: 70%;
padding:20px;
float: left;
}
</style>
<style>
/* <div style="clear: left;"></div> */
div#section::after{
content: "";
display: table;
clear: both;
}
</style>
<body>
<h2>div(๋ฐฐ์น, layout) + css ex01.html</h2>
<!-- header>h2>{Cites - ์๋ฉํฑ ํ๊ทธ( sematic elements )} -->
<div id="header">
<h2>Cites - sematic elements</h2>
</div>
<!-- section>(nav>ul>li*3>a[href='#'])+(article>(h2>{London}^p*2>lorem)*3) -->
<div id="section">
<div id="nav">
<ul>
<li><a href="#">London</a></li>
<li><a href="#">Paris</a></li>
<li><a href="#">Seoul</a></li>
</ul>
</div>
<div id="article">
<h2>London</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse ratione dolorem fuga ipsa odio voluptate in quas cumque error at rem iure doloribus accusamus vel assumenda! Impedit quidem aliquam maiores?</p>
<p>Necessitatibus minima rerum dolorum hic adipisci perspiciatis nostrum molestiae amet accusamus quia beatae repellendus cum aliquam sapiente excepturi odio iste ipsum dolorem tempora blanditiis. Quo minus suscipit id cum totam.</p>
<h2>Paris</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium eligendi repellendus nam aperiam placeat explicabo tempore quasi nulla atque delectus eius laudantium est officia amet at doloremque enim nisi blanditiis.</p>
<p>Harum ea est dolore animi officia quisquam cumque in. Beatae voluptatum inventore tempora ratione minus explicabo tenetur dicta recusandae earum libero aut ab quibusdam tempore? Debitis itaque nulla voluptates delectus.</p>
<h2>Seoul</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam laudantium non expedita omnis facilis quod explicabo tempora tempore pariatur sapiente velit est laborum dolorum ad quae aperiam quia cumque quidem.</p>
<p>Natus quisquam neque ipsum dolores quidem. Ad distinctio commodi voluptatum eveniet nobis at reiciendis aperiam veritatis itaque cumque facilis cum incidunt explicabo iure illum. Eligendi ullam aperiam excepturi nisi quos.</p>
</div>
</div>
<!-- footer>h2{Footer} -->
<!-- float:left -->
<!--
<div style="clear: left;"></div>
-->
<div id="footer">
<h2>Footer</h2>
</div>
</body>
* footer ์๋์ผ๋ก float : left ๋ก ์๋์ผ๋ก ์ ์ฉ (width ํผ์ผํธ ๋จ์ผ๋ฉด)
* section๊ณผ footer ๋๋ ์ฃผ๊ธฐ์ํด <div style="clear: left;"></div> ๋ฃ์ด์ค (์์ฆ ์ด๋ ๊ฒ ์ํจ)
->
<style>
/* <div style="clear: left;"></div> */
div#section::after{
content: "";
display: table;
clear: both;
}
</style>
header์ footer๋ก
<style>
*{
box-sizing: border-box; /* css ์์
*/
}
body{
font-family: Arial, Helvetica, sans-serif;
}
header{
background-color: #666;
color:white;
padding: 30px;
text-align: center;
font-size: 35px;
}
footer{
background-color: #777;
color:white;
padding: 15px;
text-align: center;
font-size: 25px;
}
</style>
<style>
nav{
background-color: #ccc;
width: 30%;
height: 300px;
padding: 20px;
float: left;
}
nav ul{
/* background-color: red; */
list-style-type: none;
padding: 0;
/* margin: 0; */
}
article{
background-color: #f1f1f1;
min-height: 300px;
width: 70%;
padding:20px;
float: left;
}
</style>
<style>
/* <div style="clear: left;"></div> */
section::after{
content: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
display: table;
clear: both;
}
</style>
<style>
/* ๋ฐ์ํ ์น */
/* ๋ฏธ๋์ด ์ฟผ๋ฆฌ */
/* % */
@media ( max-width:800px ){
nav, article{
width:100%;
height:auto;
}
}
</style>
<body>
<!--
[html layout(๋ฐฐ์น) ๋ฐฉ๋ฒ]
*** 1. css float ์์ฑ ***
2. css flexbox
3. css ํ๋ ์์ํฌ - ๋ถํธ์คํธ๋ฉ( Bootstrap )
4. css ๊ทธ๋ฆฌ๋ ๋ ์ด์์
-->
<h2>div(๋ฐฐ์น, layout) + css</h2>
<!-- header>h2>{Cites - ์๋ฉํฑ ํ๊ทธ( sematic elements )} -->
<header>
<h2>Cites - sematic elements </h2>
</header>
<!-- section>(nav>ul>li*3>a[href='#'])+(article>(h2>{London}^p*2>lorem)*3) -->
<section>
<nav>
<ul>
<li><a href="#">London</a></li>
<li><a href="#">Paris</a></li>
<li><a href="#">Seoul</a></li>
</ul>
</nav>
<article>
<h2>London</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse ratione dolorem fuga ipsa odio voluptate in quas cumque error at rem iure doloribus accusamus vel assumenda! Impedit quidem aliquam maiores?</p>
<p>Necessitatibus minima rerum dolorum hic adipisci perspiciatis nostrum molestiae amet accusamus quia beatae repellendus cum aliquam sapiente excepturi odio iste ipsum dolorem tempora blanditiis. Quo minus suscipit id cum totam.</p>
<h2>Paris</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Praesentium eligendi repellendus nam aperiam placeat explicabo tempore quasi nulla atque delectus eius laudantium est officia amet at doloremque enim nisi blanditiis.</p>
<p>Harum ea est dolore animi officia quisquam cumque in. Beatae voluptatum inventore tempora ratione minus explicabo tenetur dicta recusandae earum libero aut ab quibusdam tempore? Debitis itaque nulla voluptates delectus.</p>
<h2>Seoul</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam laudantium non expedita omnis facilis quod explicabo tempora tempore pariatur sapiente velit est laborum dolorum ad quae aperiam quia cumque quidem.</p>
<p>Natus quisquam neque ipsum dolores quidem. Ad distinctio commodi voluptatum eveniet nobis at reiciendis aperiam veritatis itaque cumque facilis cum incidunt explicabo iure illum. Eligendi ullam aperiam excepturi nisi quos.</p>
</article>
</section>
<!-- footer>h2{Footer} -->
<footer>
<h2>Footer</h2>
</footer>
</body>
* max-width 800๊น์ง๋ ์ด๊ฒ ์ ์ฉ
์๋ฉํธ( semantic == ์๋ฏธ๋ก ์ ์ธ ) ํ๊ทธ
1. ์๋ฉํฑ ํ๊ทธ ? ์๋ฏธ๊ฐ ์๋ ํ๊ทธ(์์)
2. ๋๊ตฌํํ ์๋ฏธ? ๋ธ๋ผ์ฐ์ ์ ๊ฐ๋ฐ์์๊ฒ ์๋ฏธ๊ฐ ์๋ ํ๊ทธ
3. ์๋ฏธ O - header ( div id='header'), form, table, section, nav ๋ฑ๋ฑ
์๋ฏธ X - div , span
4. ์๋ฉํฑ ํ๊ทธ์ ์ข ๋ฅ
1) header - ์๊ฐ ๋ด์ฉ์ด๋ ํ์ ๋งํฌ์ ์งํฉ์ ๋ํ ์ปจํ ์ด๋
2) section - ๋ฌธ์์ ์น์ (์ ๋ชฉ์ด ์๋ ์ฃผ์ ๋ณ ์ปจํ ์ธ ๊ทธ๋ฃน)์ ์ ์ํ๋ ํ๊ทธ
์ฅ/์๊ฐ/๋ด์ค ํญ๋ชฉ/ ์ฐ๋ฝ์ฒ ์ ๋ณด
3) article - ๊ธฐ์ฌ(๊ทธ ์์ฒด์ ์๋ฏธ), ๋ ๋ฆฝ์ ์ธ ์์ฒด์ ํฌํจ๋ ๋ด์ฉ์ ์ง์ ํ๋ ํ๊ทธ
- ์น ํ์ด์ง์ ๋๋จธ์ง ๋ถ๋ถ๊ณผ ๋ ๋ฆฝ์ ์ผ๋ก ๋ฐฐํฌํ ์ ์์ด์ผ ๋๋ค.
์ ๋ฌธ๊ธฐ์ฌ๋ค, ์ ํ ์นด๋, ์ฌ์ฉ์ ์๊ฒฌ, ๋ธ๋ก๊ทธ ๊ฒ์๊ธ, ํฌ๋ผ ๊ฒ์๊ธ.
์ฐธ๊ณ ) section ํ๊ทธ ์์ article ์ค์ฒฉ๋์ด์ง ์ ๋ ์๊ณ ,
article ํ๊ทธ ์์ section ์ค์ฒฉ ๋์ด์ง ์๋ ์๋ค.
4) footer - ๋ฐ๋ฅ๊ธ, ๋ฌธ์๋ ๊ตฌ์ญ์ ๋ฐ๋ฅ๊ธ์ ์ ์ํ๋ ํ๊ทธ
- ์ ์๊ถ ์ ๋ณด, ์ฐ๋ฝ์ฒ ์ ๋ณด, ์ฌ์ดํธ ๋งต , ๋งจ ์๋ก ๋งํฌ, ๊ด๋ จ๋ ๋ฌธ์
5) nav - ํ์ ๋งํฌ์ ์งํฉ์ ์ ์ํ๋ ํ๊ทธ
๋ฌธ์์ ๋ชจ๋ ํ์๋งํฌ๋ค์ด nav ํ๊ทธ ์์ ์์ด์ผ ๋๋ ๊ฒ์ ์๋๋ค.
์ฃผ์ ๋งํฌ
6) aside - ํ์ชฝ์ผ๋ก , ๋ฐ๋ก
- ์ด๋ค ์ฃผ์ ๋ด์ฉ๊ณผ ๊ด๋ จ๋ ์ด๋ค ์ฝํ ์ธ ๋ฅผ ์ ์ํ๋ ํ๊ทธ
7) figure/figcaption - ๊ทธ๋ฆผ, ๋ํ, ์ฌ์ง, ์ฝ๋ ๋ชฉ๋ก ๋ด์ฉ์ ์ ์ํ๋ ํ๊ทธ
์)
<figure>
<img />
<figcaption>์ด๋ฏธ์ง ์ค๋ช
</figcaption>
</figure>
8) details, main, mark, summary, time
html - iframe ํ๊ทธ
1. inline + frame = iframe
์ผ๋ ฌ๋ก ๋์ด์ ์๋์ฐ , ์ฐฝ
์ง๋ ฌ์
2. ์ธ๋ผ์ธํ๋ ์์ ํ์ฌ html ๋ฌธ์ ๋ด์ ๋ ๋ค๋ฅธ ๋ฌธ์๋ฅผ ํฌํจํ๋ ๋ฐ ์ฌ์ฉ.
3. ์น ํ์ด์ง [ ๋ด์ ] ์น ํ์ด์ง๋ฅผ ํ์ํ๋ ๋ฐ ์ฌ์ฉ.
์ ?
์) ํ์ฌ ๋ ์ง/์๊ฐ ์ ๋ณด๋ฅผ ๋ชจ๋ ์น ํ์ด์ง์ ์ฐ์ธก ์๋จ์ ์ถ๋ ฅ.
http://trio.co.kr/club/public/clock.html
4. 500 ํ์ด์ง ์ด์์ ์น ํ์ด์ง.. ์์ฑ - ์์ , ์ญ์ ( ์ ์ง, ๋ณด์)
<body onload="show()" style="margin:0;padding:0">
<div id="clock" align=center style="margin:0;padding:1px;font-size:9pt;width:9em;color:00f;background-color:cfc;"></div>
<script>
function show(){
var now=new Date();
var dy=now.getDate();
var mt=now.getMonth()+1;
var hr=now.getHours();
var mn=now.getMinutes();
var sc=now.getSeconds();
var ampm="<sup>์ค์ </sup>";
if (hr>=12) ampm="<sub>์คํ</sub>";
if (hr>12) hr=hr-12;
if (hr==0) hr=12;
// if (hr<=9) hr="0"+hr;
if (mn<=9) mn="0"+mn;
if (sc<=9) sc="0"+sc;
clock.innerHTML=" <b>"+mt+"</b>/<b>"+dy+"</b> "+ampm+" "+hr+":"+mn+":" +sc;
setTimeout("show()",1000);
}
</script>
</body>
->
<!-- (a>lorem1^br)*5 -->
<a href="">Lorem.</a> <br>
<a href="">Provident.</a> <br>
<a href="">Libero.</a> <br>
<a href="">Recusandae!</a> <br>
<a href="">At.</a> <br>
<!-- ์ธ๋ผ์ธ๋ชจ๋ -->
<iframe name="datetime" title=""ํ์ฌ ๋ ์ง/์๊ฐ" src="http://trio.co.kr/club/public/clock.html" frameborder="1"></iframe>
<iframe name="datetime" title=""ํ์ฌ ๋ ์ง/์๊ฐ" src="http://trio.co.kr/club/public/clock.html" style="border:1px solid red"></iframe>
<!-- ํ๋ ์์ ํ
๋๋ฆฌ ์ ๊ฑฐ -->
<iframe name="datetime" title=""ํ์ฌ ๋ ์ง/์๊ฐ" src="http://trio.co.kr/club/public/clock.html" style="border:none;"></iframe>
head ํ๊ทธ
1. head ํ๊ทธ
- ์นํ์ด์ง์ ์ ๋ณด๋ฅผ ๋ํ๋ด๋ ํ๊ทธ
- ๋ฉํ๋ฐ์ดํฐ( ๋ฐ์ดํฐ์ ๋ํ ๋ฐ์ดํฐ )์ ์ปจํ ์ด๋
- html ๋ฉํ๋ฐ์ดํฐ ? html ๋ฌธ์์ ๋ํ ๋ฐ์ดํฐ
- ํ๋ฉด ํ์ X
- ๋ฉํ๋ฐ์ดํฐ๋ ์ผ๋ฐ์ ์ผ๋ก ๋ฌธ์ ์ ๋ชฉ, ์คํ์ผ, ์คํฌ๋ฆฝํธ
๊ทธ ์ธ์ ๋ฉํ ์ ๋ณด๋ฅผ ์ ์
2. head ํ๊ทธ์ ์์ ํ๊ทธ
1) title : ๋ฌธ์ ์ ๋ชฉ
2) style : ๋ฌธ์ ์คํ์ผ ์ ๋ณด ์ ์
3) script :์คํฌ๋ฆฝํธ
4) meta :
ใฑ) meta charset="UTF-8" ์น ๋ฌธ์์์ ์ฌ์ฉ๋ ์ธ์ฝ๋ฉ(๋ฌธ์์ ) ์ ์
meta ์ข ๋ฅ ๊ฒ์ ( *** )
5) link : css ์ธ๋ถ ๋ฆฌ์์ค(์์)๊ณผ ์ฐ๊ฒฐ ํ๊ทธ
6) base : ํ์ด์ง์ ๋ชจ๋ ์๋ ์ฃผ์์ ๋ํ ๊ธฐ๋ณธ ์ฃผ์ ๋ฐ ๋์์ ์ง์ ํ๋ ํ๊ทธ.
๊ธฐ์ด
๋ฐ์ํ ์น
1. ๋ชจ๋ ์ฅ์น์์ ์น ํ์ด์ง๊ฐ ๋ณด๊ธฐ ์ข๊ฒ ๋ง๋๋ ๊ฒ.
2. ๋ค์ํ ํ๋ฉด ํฌ๊ธฐ์ ๋ทฐํฌํธ์ ๋ง๊ฒ ์๋์ผ๋ก ์กฐ์ ๋๊ฒ ํ๋ ๊ฒ.
3. <meta name="viewport" content="width=device-width, initial-scale=1.0"> ์ฝ๋ฉ ์ถ๊ฐ
4. ๋ฐ์ํ ์น ๋์์ธ
1) ๋ฐ์ํ ์ด๋ฏธ์ง ์ฒ๋ฆฌ
๋๋น(width) ์์ฑ: %
2) ๋ฐ์ํ ํ ์คํธ ์ฒ๋ฆฌ : vw [v]iewport [w]idth
<h1 style="font-size:10vw"></h1>
๋ทฐํฌํธ๋ ๋ธ๋ผ์ฐ์ ์ฐฝ์ ํฌ๊ธฐ์ด๋ค.
1vw == ๋ทฐํฌํธ ๋๋น์ 1%
๋ทฐํฌํธ(๋ธ๋ผ์ฐ์ ์ฐฝ ํฌ๊ธฐ) ๋๋น๊ฐ 50cm ์ธ ๊ฒฝ์ฐ 1vw == 0.5cm
๋ทฐํฌํธ(๋ธ๋ผ์ฐ์ ์ฐฝ ํฌ๊ธฐ) ๋๋น๊ฐ 100cm ์ธ ๊ฒฝ์ฐ 1vw == 1cm
3) ๋ฏธ๋์ด ์ฟผ๋ฆฌ @media ์ฝ๋ฉ.
- ๋ฐ์ํ ์น
- ๋ฏธ๋์ด ์ฟผ๋ฆฌ๋ฅผ ์ฌ์ฉํด์ ํ ์คํธ์ ์ด๋ฏธ์ง์ ํฌ๊ธฐ๋ฅผ ์ฅ์น์ ๋ง์ถฐ ์กฐ์ ...
@media(max-width:800px){
nav, section{
width:100%;
font-size:10vw;
}
}
์ด๋ชจํฐ์ฝ
1. ์ด๋ชจํฐ์ฝ์ ์ด๋ฏธ์ง ๋๋ ์์ด์ฝ ์ฒ๋ผ ์ถ๋ ฅ์ด ๋์ง๋ง ๋ฌธ์์ด๋ค.
2. meta charset="UTF-8" ์ถ๊ฐ
<h1> 😄 </h1>
<h1> 😍 </h1>
<h1 style="font-size: 48px"> 💗 </h1>
[ html ์ฝ๋ฉ ๊ท์น(๊ฐ์ด๋) ]
1. ๋ฌธ์ ์ ํ ์ ์ธ DOCTYPE html : ๋๋ฌธ์ ๊ถ์ฅ
2. ์์(ํ๊ทธ) : ์๋ฌธ์ ๊ถ์ฅ
3. ๋ชจ๋ ์์๊ฐ ์ข ๋ฃํ๊ทธ๊ฐ ํ์ํ ๊ฒ์ ์๋๋ค.
meta, br , hr , img X
4. img src = "" = ๋ฑํธ ์ฐ์ฐ์ ์ ๋ค์ ๊ณต๋ฐฑ ์ฌ์ฉ X
5. p ํ๊ทธ๋ ๋ฐ๋์ ์ข ๋ฃ ํ๊ทธ๋ฅผ ์ฝ๋ฉํ์.
***** 6. ์์ฒญURL( ํด๋๋ช , ํ์ผ๋ช )์ ๋ฐ๋์ ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ๋ค. *****
http://localhost/webPro/html/days05/ex06.html -> ์น์๋ฒ(ํฐ์บฃ)
7. ํ์ผ ํ์ฅ์ : .html .htm
์ธ๋ถ css ํ์ผ : .css
์ธ๋ถ js ํ์ผ : .js
html Form(์์)
1. html form(์์)ํ๊ทธ๋ ์ฌ์ฉ์ ์ ๋ ฅ์ ์์งํ๋ ๋ฐ ์ฌ์ฉ๋๋ ํ๊ทธ.
[]
[] -> ์ ์ก -> ์๋ฒ ์ ์ก
[]
2. form ํ๊ทธ์ ์ฌ์ฉ๋๋ ์ ๋ ฅํ๊ทธ
3. ์๋ฒ ์ ์ก - ์๋ธ๋ฐ( submit ) == ์ ์ถํ๋ค.
<form action="ex08_ok.jsp" method="get">
<!-- <form action="" method="get"> -->
<label for="id">์์ด๋</label> : <input type="text" id="id" name="id" autofocus="autofocus" placeholder="์์ด๋๋ฅผ ์
๋ ฅํ์ธ์."><br>
<label for="passwd">๋น๋ฐ๋ฒํธ</label> : <input type="password" id="passwd" name="passwd" maxlength="15" ><br>
<input type="checkbox" id="autosave" name="autosave" value="y"><label for="autosave">์์ด๋ ์๋ ์ ์ฅ</label><br>
<input type="submit" value="๋ก๊ทธ์ธ">
<input type="reset">
</form>
method=get
http://localhost/webPro/html/days05/ex08_ok.jsp
?์์ฒญํ๋ผ๋ฏธํฐ=๊ฐ&์์ฒญํ๋ผ๋ฏธํฐ=๊ฐ&...
http://localhost/webPro/html/days05/ex08_ok.jsp
? ์์ฒญ ํ๋ผ๋ฏธํฐ == QueryString
id=admin
&
passwd=1234
&
autosave=y
<%
// WAS
// ์๋ฐ ์ฝ๋ฉ~ [์คํฌ๋ฆฝํธ๋ฆฟ]
String id = request.getParameter("id");
String passwd = request.getParameter("passwd");
%>
<!-- ํํ์ -->
> ์
๋ ฅํ ์์ด๋ : <%= id %><br>
> ์
๋ ฅํ ๋น๋ฐ๋ฒํธ : <%= passwd %><br>
-> ํ์ด์ง ๋ฆฌ์์ค์์ ์๋ณด์ = WAS๊ฐ JSP์ ์๋ฐํ์ผ ์ปดํ์ผ
-> ์์ฒญ ๋ฐ๋๊ฒ WebServer
* autofocus - ์ปค์ ๊น๋นก
* type password, maxlength
* name ์์ฑ์ผ๋ก ๋๊ฒจ์ค
* input ํ๊ทธ๋ ๋ฌด์กฐ๊ฑด form ํ๊ทธ ์์!
**** action ์์ฑ๊ฐ์ด ์๋ ๊ฒฝ์ฐ๋ ์๊ธฐ ์์ ์์ฒญ URL ์์ฒญํ๋ค. (action=""์ ์๋ฌด๊ฒ๋ ์๋ค์ด์๋๊ฒฝ์ฐ)
<form action="ex08_ok.jsp" method="get">
<!-- <form action="" method="get"> -->
get : querystring(?) ๋์ด๊ฐ=๋ณด์์ ๋ถ๋ฆฌ, https๋ก ๋ฐ๊พธ๋ฉด querystring ์ํธํ๋จ(ํต์ ํ๋กํ ์ฝ) post : querystring(?) ์๋์ด๊ฐ=๋ณด์์ ์ ๋ฆฌ, ์ฒจ๋ถํ์ผ, |
** label ํ๊ทธ๋ฅผ ์ฌ์ฉํ๋ ์ด์ ? ์ฌ์ฉ์๊ฐ ์
๋ ฅ ์์์ ์ด์ ์ ๋ง์ถ๋ฉด
์คํฌ๋ฆฐ ๋ฆฌ๋๊ฐ ๋ ์ด๋ธ์ ์๋ฆฌ๋ด์ด ์ฝ์ด์ฃผ๋ ์ญํ ๋ ํ๊ณ , ๋ผ๋์ค๋ฒํผ, ์ฒดํฌ๋ฐ์ค
๊ฐ ํ ๊ธ์ด ๋๊ธฐ ๋๋ฌธ์ ์ฌ์ฉํ๋ค.
** for ์์ฑ ์ค์ - ๋ฌถ์ ์์๋ฅผ ์ง์ . (label๊ณผ input์ ๋ฌถ์ด์ ๋๊ธฐํ, id ๊ฐ์ผ๋ก ๋ฌถ์)
body
<h3>ex08_02.html - html Form(์์)</h3>
<form id="form1" action="ex08_ok.jsp" method="get">
<label for="id">์์ด๋</label> : <input type="text" required="required"
id="id" name="id" autofocus="autofocus" placeholder="์์ด๋๋ฅผ ์
๋ ฅํ์ธ์."><br>
<label for="passwd">๋น๋ฐ๋ฒํธ</label> : <input type="password" id="passwd"
name="passwd" maxlength="15"><br> <input
type="checkbox" id="autosave" name="autosave" value="y"><label
for="autosave">์์ด๋ ์๋ ์ ์ฅ</label><br> ๋์ด : <input type="number"
id="age" readonly="readonly" value="20" name="age" min="0" max="150"><br>
์ด๋ฉ์ผ : <input type="email" disabled="disabled"><br>
<!-- <input type="submit" value="๋ก๊ทธ์ธ"> -->
<input type="button" value="๋ก๊ทธ์ธ" onclick="server_submit();"> <input
type="reset">
</form>
- required / placeholder / autofocus / maxlength / readonly / disabled /
- submit -> ์๋ฒ๋ก ์ ๋ ฅ๊ฐ ์ ์ถ
button -> onclick ์์ฑ ์ค์ js ํธ์ถํด์ผํจ (server_submit())
<script>
function server_submit(){
// console.log("์ผ๋ฐ ๋ก๊ทธ์ธ ๋ฒํผ ํด๋ฆญํจ!!!");
var f1 = document.getElementById("form1");
// js submit() ํจ์
f1.submit();
}
</script>
<form action="ex08_02_ok.jsp">
์์ ํ ์๋์ฐจ๋ฅผ ์ ํํ์ธ์. <br>
<!-- ๋ค์ค ์ ํ multiple="multiple"-->
<select name="cars" id="cars" >
<optgroup label="๊ตญ์ธ">
<option value="1">BMW</option>
<!-- value ์์ฑ๊ฐ์ ์๋ตํ๋ฉด ํ
์คํธ๊ฐ๊ณผ ๋์ผํ๋ค. -->
<option value="AUDI">AUDI</option>
<option>VOLVO</option>
</optgroup>
<optgroup label="๊ตญ๋ด">
<!-- ์ด ์ต์
์ ๊ธฐ๋ณธ์ผ๋ก ์ ํ(select) ํด ๋๊ณ ์ถ๋ค. -->
<option selected="selected">KIA</option>
<option selected="selected">SM</option>
</optgroup>
</select> <input type="submit">
</form>
- select, option
'๐จโ๐ป Web Development > HTML | CSS | JS | jQuery' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Day1] CSS 1 - ๊ฐ์, ์คํ์ผ ์ ์ฉ ๋ฐฉ๋ฒ (0) | 2022.11.10 |
---|---|
[Day6] HTML 6 - div ํ์ด์ง, ๋ฐ์ํ์น, form, canvas,svg, ๋ฉํฐ๋ฏธ๋์ด, youtube (0) | 2022.11.10 |
[Day4] HTML 4 - ul,li, div, jquery, emmet (0) | 2022.11.07 |
[Day3] HTML 3 - ์ด๋ฏธ์ง, ์ด๋ฏธ์ง๋งต, picture, favicon,table (0) | 2022.11.07 |
[Day2] HTML 2 - ์ฌ๋ฌ๊ฐ์ง ํ๊ทธ (0) | 2022.11.06 |
์ต๊ทผ๋๊ธ