336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

안녕하세요. 이번엔 JAVASCRIPT에서 background 이미지와 이미지 크기 및 반복 안하는 방법에 대해서 간단하게 알려드리겠습니다..

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<script>
    window.onload = function(){
    //반복제거, url
    document.getElementById("div").style.backgroundRepeat = "no-repeat";
    //이미지 등록
    document.getElementById("div").style.backgroundImage = "url('해당파일위치')";
    //이미지 사이즈
    document.getElementById("div").style.backgroundSize = "200px";
    }
</script>
 
<div id='div'>
 
</div>
cs

+ Recent posts