본문 바로가기

개발하자/자바스크립트

외부파일로 css스타일 적용 시키고 js이벤트 주기

a.js

==================================

window.onload=function(){
fontTag.onclick=function(){
 alert("홍길동");
}
}

 

c.css

===================================

font { color:red; }

 

 

a.html

=======================================

<html>
 <head>
 <link rel="stylesheet" href="c.css" type="text/css">   
<script src="a.js"></script>  
 </head>
 <body>
<font id="fontTag">aaa</font>
 </body>
</html>