<html>
<head>
<title></title>
<meta name='author' content=''>
<meta name='keywords' content=''>
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='pragma' content='no-cache'>
<meta http-equiv='content-type' content='text/html; charset=euc-kr'>
<link rel='stylesheet' href='/include/css.css' type='text/css'>
</head>
<body>
<script language='javascript'>
/**
* 파일명 : lib.textSlider.js
* 설 명 : 스크롤 배너 라이브러리
* 작성자 : lainTT[김군우] - jstoy project
* Modify : aucd29(aucd29@daum.net);
* 날 짜: 2004-03-30, 2004-12-14
*
***********************************************
*/
SmoothBanner = function(className,id,base,speed) { // 2004-12-14 base, speed 추가. code by kurome
this.IE = document.all ? 1 : 0;
this.NN = document.layer ? 1 : 0;
this.N6 = document.getElementById ? 1 : 0;
if(this.IE) this.layer = document.all(id);
else if(this.NN) this.layer = document.layer[id];
else if(this.N6) this.layer = document.getElementById(id);
else return;
this.top = this.oldY = this.layer.style.top = base;
this.speed = speed;
this.className = className;
setInterval(this.className + ".move()", this.speed);
}
SmoothBanner.prototype.move = function() {
var diffY = (this.IE) ? document.body.scrollTop+this.top : self.pageYOffset+this.top; // modify
if(diffY != this.oldY) {
var percentY = .1 * (diffY - this.oldY);
percentY = (percentY > 0) ? Math.ceil(percentY) : Math.floor(percentY);
this.oldY += percentY;
this.layer.style.top = this.oldY + "px";
}
}
</script>
<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center'>
<tr>
<td><div align='center' id='test' style="position: absolute;">Hello world<br>hahaha<br>hohoho<br>dfasdfasdf</div></td>
<td><div align='center' id='test2' style="position: absolute;">Hello world<br>hahaha<br>hohoho<br>dfasdfasdf</div></td>
</tr>
</table>
<script language="javascript">
var SB = new SmoothBanner('SB','test',250,15);
var SB2 = new SmoothBanner('SB2','test2',0,20);
</script>
<br><br><br><br><br><br><br><br><br><><br><br><br><br><br><br><br>
</body>
</html>
<head>
<title></title>
<meta name='author' content=''>
<meta name='keywords' content=''>
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='pragma' content='no-cache'>
<meta http-equiv='content-type' content='text/html; charset=euc-kr'>
<link rel='stylesheet' href='/include/css.css' type='text/css'>
</head>
<body>
<script language='javascript'>
/**
* 파일명 : lib.textSlider.js
* 설 명 : 스크롤 배너 라이브러리
* 작성자 : lainTT[김군우] - jstoy project
* Modify : aucd29(aucd29@daum.net);
* 날 짜: 2004-03-30, 2004-12-14
*
***********************************************
*/
SmoothBanner = function(className,id,base,speed) { // 2004-12-14 base, speed 추가. code by kurome
this.IE = document.all ? 1 : 0;
this.NN = document.layer ? 1 : 0;
this.N6 = document.getElementById ? 1 : 0;
if(this.IE) this.layer = document.all(id);
else if(this.NN) this.layer = document.layer[id];
else if(this.N6) this.layer = document.getElementById(id);
else return;
this.top = this.oldY = this.layer.style.top = base;
this.speed = speed;
this.className = className;
setInterval(this.className + ".move()", this.speed);
}
SmoothBanner.prototype.move = function() {
var diffY = (this.IE) ? document.body.scrollTop+this.top : self.pageYOffset+this.top; // modify
if(diffY != this.oldY) {
var percentY = .1 * (diffY - this.oldY);
percentY = (percentY > 0) ? Math.ceil(percentY) : Math.floor(percentY);
this.oldY += percentY;
this.layer.style.top = this.oldY + "px";
}
}
</script>
<table cellspacing='0' cellpadding='0' border='0' width='95%' align='center'>
<tr>
<td><div align='center' id='test' style="position: absolute;">Hello world<br>hahaha<br>hohoho<br>dfasdfasdf</div></td>
<td><div align='center' id='test2' style="position: absolute;">Hello world<br>hahaha<br>hohoho<br>dfasdfasdf</div></td>
</tr>
</table>
<script language="javascript">
var SB = new SmoothBanner('SB','test',250,15);
var SB2 = new SmoothBanner('SB2','test2',0,20);
</script>
<br><br><br><br><br><br><br><br><br><><br><br><br><br><br><br><br>
</body>
</html>
'Web > Javascript' 카테고리의 다른 글
DHTML 을 이용한 클라이언트 스크립트로 Element 생성의 가능성 (0) | 2013.09.26 |
---|---|
for(var j in _options) (0) | 2013.09.26 |
레이어 위에 올라가는 셀렉트 박스 해결 (0) | 2013.09.26 |
배열인지 아닌지 구분해주기 (0) | 2013.09.26 |
td사이즈 실시간으로 이동하기 (0) | 2013.09.26 |