😀 html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
div{
height: 50px;
border: 2px dotted blue;
}
</style>
<script src="../js/outscript.js" type="text/javascript"></script>
</head>
<body>
<input type="button" value="확인" onclick="proc1()">
<br>
<br>
<p>버튼을 클릭하면 입력받아 출력한다</p>
<div></div>
</body>
</html>
😀 javascript
/**
*
*/
proc1 = () =>{
vinput = prompt("입력하세요");
//div를 검색
vdiv = document.getElementsByTagName('div')[0]
vdiv.innerText = vinput;
vdiv.innerHTML = vinput;
/*
var str;
str = "<h1>" + vinput + "</h1>" ;
var str = "<h1>" + vinput + "</h1>" ;
*/
str = "<h1>" + vinput + "</h1>" ;
vdiv.innerHTML =str;
// vdiv.innerText = str;
}
/*
proc1 = () =>{
}
function proc1(){
}
*/
😀 실행
'웹프로그래밍(HTML, CSS3, JavaScript)' 카테고리의 다른 글
[html] documentwrite (0) | 2022.12.29 |
---|---|
[html/jsp] position위치 (0) | 2022.12.27 |
[html/jsp] 리스트 연습 (0) | 2022.12.27 |
[html/jsp] wordwrapping (0) | 2022.12.27 |
[html/jsp] table스타일 (0) | 2022.12.27 |