YesYo.com MintState Forums
뒤로    YesYo.com MintState BBS > Tech > Javascript
검색
멤버이름    오토
비밀번호 
 

레이어 상하로 글자들이 스크롤되게하기

페이지 정보

작성자 MintState 댓글 0건 조회 9,216회 작성일 08-10-31 11:54

본문

레이어 상하로 글자들이 스크롤되게하기

<table width="100" border="1" cellspacing="0" cellpadding="0">
	<tr>
		<td align="center"><a href="javascript:slidetop1()">▲</a></td>
	</tr>
	<tr>
		<td height="100">
			<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td>
<script language="JavaScript1.2">
var sliderwidth=100
var sliderheight=100
var slidespeed=1
slidebgcolor="#FFFFFF"

var topbottomslide=new Array()
var finalslide=''
topbottomslide[0]='<tr><td valign="top" align="center">1</td></tr>'
topbottomslide[1]='<tr><td valign="top" align="center">2</td></tr>'
topbottomslide[2]='<tr><td valign="top" align="center">3</td></tr>'
topbottomslide[3]='<tr><td valign="top" align="center">4</td></tr>'
topbottomslide[4]='<tr><td valign="top" align="center">5</td></tr>'
topbottomslide[5]='<tr><td valign="top" align="center">6</td></tr>'
topbottomslide[6]='<tr><td valign="top" align="center">7</td></tr>'
topbottomslide[7]='<tr><td valign="top" align="center">8</td></tr>'
topbottomslide[8]='<tr><td valign="top" align="center">9</td></tr>'

var copyspeed=slidespeed
topbottomslide='<nobr><table width="100" align="left" border="0">'+topbottomslide.join(" ")+'</table></nobr>'
var iedom=document.all||document.getElementById
if (iedom)
	document.write('<span id="temp" style="visibility:hidden;position:absolute;top:20;left:-1000">'+topbottomslide+'</span>')
var actualtop=''
var cross_slide, ns_slide

function fillup(){
	if (iedom){
		cross_slide=document.getElementById? document.getElementById("shopwizjs1") : document.all.shopwizjs1
		cross_slide2=document.getElementById? document.getElementById("shopwizjs2") : document.all.shopwizjs2
		cross_slide.innerHTML=cross_slide2.innerHTML=topbottomslide
		actualtop=document.all? cross_slide.offsetHeight : document.getElementById("temp").offsetHeight
		cross_slide2.style.top=actualtop+3
		//alert(cross_slide.offsetHeight+','+ document.getElementById("temp").offsetHeight)
	}else if (document.layers){
		ns_slide=document.ns_slidemenu.document.ns_slidemenu2
		ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
		ns_slide.document.write(topbottomslide)
		ns_slide.document.close()
		actualtop=ns_slide.document.width
		ns_slide2.top=actualtop+3
		ns_slide2.document.write(topbottomslide)
		ns_slide2.document.close()
	}

	slidetop()
}
window.onload=fillup

function slidetop(){
	if (iedom){
		if (parseInt(cross_slide.style.top)>(actualtop*(-1)+8))
			cross_slide.style.top=parseInt(cross_slide.style.top)-copyspeed
		else
			cross_slide.style.top=parseInt(cross_slide2.style.top)+actualtop+3

		if (parseInt(cross_slide2.style.top)>(actualtop*(-1)+8))
			cross_slide2.style.top=parseInt(cross_slide2.style.top)-copyspeed
		else
			cross_slide2.style.top=parseInt(cross_slide.style.top)+actualtop+3
	}
	else if (document.layers){
		if (ns_slide.top>(actualtop*(-1)+8))
			ns_slide.top-=copyspeed
		else
			ns_slide.top=ns_slide2.top+actualtop+3
		
		if (ns_slide2.top>(actualtop*(-1)+8))
			ns_slide2.top-=copyspeed
		else
			ns_slide2.top=ns_slide.top+actualtop+3
	}
	lefttime=setTimeout("slidetop()",30)
	//clearTimeout(righttime)
}

//왼쪽 스크롤
function slidetop1(){
	if (iedom){
		if (parseInt(cross_slide.style.top)>(actualtop*(-1)+8))
			cross_slide.style.top=parseInt(cross_slide.style.top)-copyspeed
		else
			cross_slide.style.top=parseInt(cross_slide2.style.top)+actualtop+3

		if (parseInt(cross_slide2.style.top)>(actualtop*(-1)+8))
			cross_slide2.style.top=parseInt(cross_slide2.style.top)-copyspeed
		else
			cross_slide2.style.top=parseInt(cross_slide.style.top)+actualtop+3
	}else if (document.layers){
		if (ns_slide.top>(actualtop*(-1)+8))
			ns_slide.top-=copyspeed
		else
			ns_slide.top=ns_slide2.top+actualtop+3

		if (ns_slide2.top>(actualtop*(-1)+8))
			ns_slide2.top-=copyspeed
		else
			ns_slide2.top=ns_slide.top+actualtop+3
	}
	lefttime=setTimeout("slidetop1()",30)
	clearTimeout(righttime)
}

//오른쪽 스크롤 
function slidebottom1(){
	if (iedom){
		if (parseInt(cross_slide.style.top)<(actualtop*(+1)-8))
			cross_slide.style.top=parseInt(cross_slide.style.top)+copyspeed
		else
			cross_slide.style.top=parseInt(cross_slide2.style.top)-actualtop-3

		if (parseInt(cross_slide2.style.top)<(actualtop*(+1)-8))
			cross_slide2.style.top=parseInt(cross_slide2.style.top)+copyspeed
		else
			cross_slide2.style.top=parseInt(cross_slide.style.top)-actualtop-3
	}
	else if (document.layers){
		if (ns_slide.right<(actualtop*(+1)+8))
			ns_slide.top+=copyspeed
		else
			ns_slide.top=ns_slide2.top+actualtop-3

		if (ns_slide2.right<(actualtop*(+1)+8))
			ns_slide2.top+=copyspeed
		else
			ns_slide2.top=ns_slide.top+actualtop-3
	}
	righttime=setTimeout("slidebottom1()",30)
	clearTimeout(lefttime)
}

//alert(iedom)
if (iedom||document.layers){
	with (document){
		document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
		if (iedom){
			write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
			write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
			write('<div id="shopwizjs1" style="position:absolute;left:0;top:0"></div>')
			write('<div id="shopwizjs2" style="position:absolute;left:0;top:-100"></div>')
			write('</div></div>')
		}
		else if (document.layers){
			write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
			write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
			write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
			write('</ilayer>')
		}
		document.write('</td></table>')
	}
}
</script>
<!-- ============================================================================ -->
			</td></tr></table>
		</td>
	</tr>
	<tr>
		<td align="center"><a href="javascript:slidebottom1()">▼</a></td>
	</tr>
</table>

댓글목록

등록된 댓글이 없습니다.

Total 178건 8 페이지
게시물 검색
모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™