JAVA_EE/JQuery
[21.09.27] exam01(01_helloJQuery)
luvforjunk
2021. 9. 27. 19:39
728x90
반응형
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../js/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
// 제이쿼리 관련된 것 처리할 것 - 앞에서 먼저 src참조 잡아줘야함 (절차식이기 때문)
function hello() {
var h1 = document.getElementById("hello");
alert(h1); // [object HTMLHeadingElement]라는 객체명 출력
alert(h1.tagName); // H1 이라는 태그명을 출력
h1.innerText = "Hello jQuery";
}
/*
window.onload = function(){
hello();
}
윈도우가 실행되자마자 hello함수 호출 - 자바스크립트 이용
*/
// 위의 방법을 제이쿼리 이용하여 실습 - 자바스크립트의 onload와 같은 효과
jQuery(hello);
</script>
</head>
<body>
<h1 id="hello"></h1>
</body>
</html>
728x90
반응형