본문 바로가기
셈틀 Com/홈페이지

자동으로 움직이는 배너

by 길목 2004. 11. 6.
<div id=divMenu style="left:10px; top:0px; visibility: visible; width: 50px; position: relative">
  <div id=divMenu style="left:0px; top:-1px; visibility: visible; width: 0px; position: absolute">
       <table border="0" width="72" cellspacing="0" cellpadding="0">
      <tr>
        <td> </td>
      </tr>
      <tr>
        <td>
          <!-- 여기가진짜테이블시작 -->
          <table border="0" cellpadding="0" cellspacing="0" width="31" class="main" style="border-collapse: collapse">
            <tr>
                      <td width="100%"><img src="quick_01.jpg" width="31" height="35"></td>
            </tr>
            <tr>
                <td><a href="bbs/zboard.php?id=lkk"><img src="quick_02.jpg" width="31" height="68" border="0"></a></td>
            </tr>
            <tr>
                <td><a href="bbs/zboard.php?id=qna"><img src="quick_03.jpg" width="31" height="64" border="0"></a></td>
            </tr>
            <tr>
                <td><a href="bbs/zboard.php?id=holyplace"><img src="quick_04.jpg" width="31" height="82" border="0"></a></td>
            </tr>
          </table>
          <!-- 여기가진짜테이블끝 -->
        </td>
      </tr>
    </table>
        
  </div>
</div>
<script language=javascript>
<!--  

var isDOM = (document.getElementById ? true : false);  
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);  

function getRef(id) {
        if (isDOM) return document.getElementById(id);
        if (isIE4) return document.all[id];
        if (isNS4) return document.layers[id];
}  

var isNS = navigator.appName == "Netscape";  

function moveRightEdge() {
        var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;  

        if (isNS4) {
                yMenuFrom   = divMenu.top;
                yMenuTo     = windows.pageYOffset + 100;
        } else if (isDOM) {
                yMenuFrom   = parseInt (divMenu.style.top, 10);
                yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 36;
        }
        timeoutNextCheck = 30;  

        if (yMenuFrom != yMenuTo) {
                yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
                if (yMenuTo < yMenuFrom)
                        yOffset = -yOffset;
                if (isNS4)
                        divMenu.top += yOffset;
                else if (isDOM)
                        divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
                        timeoutNextCheck = 5;
        }
        setTimeout ("moveRightEdge()", timeoutNextCheck);
}


if (isNS4) {
        var divMenu = document["divMenu"];
        divMenu.top = top.pageYOffset + 200;
        divMenu.visibility = "visible";
        moveRightEdge();
} else if (isDOM) {
        var divMenu = getRef('divMenu');
        divMenu.style.top = (isNS ? window.pageYOffset : document.body.scrollTop) + 60;
        divMenu.style.visibility = "visible";
        moveRightEdge();
}
//-->
</script>

위에 테이블 내용만 수정하면 됨

댓글