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

세로롤링

페이지 정보

작성자 MintState 댓글 1건 조회 16,193회 작성일 08-11-17 14:06

본문

세로롤링

rolling.js
/*************************************************************************************************
호출방법은 아래와 같습니다.
레이어명과 오브젝트명은 중복되지 않도록 주의해주세요.
**************************************************************************************************
<script language="javascript" src="rolling.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
var msg = new Array();
msg[0] = "111111111111";	// 배열길이 제한없습니다.
msg[1] = "222222222222";

SampleObj = new RollObj("SampleLayer", 215, 150, 20, msg);
LineLoop("SampleObj");	// 생성한 객체명을 넘겨줍니다.

//-->
</script>
function strReplace(str, src, dest) {

    var reg = new RegExp(src, "gi");

    return str.replace(reg, dest);
var msgT = strReplace(msg, "</aaaa>", "</script>");
	document.write(msgT);

}
**************************************************************************************************/


function RollObj(layer, w, h, speed, msg, stop) {

	this.layer = layer;
	this.w = w;
	this.h = h;
	this.speed = speed;

 	this.msg = msg;
	this.next_no = 2;

	if (stop) this.stop = stop;
	else this.stop = speed;

}

function LineLoop(objname) {
	eval("obj = "+objname+";");

	document.writeln('<div id="'+obj.layer+'0" style="position:relative; left:0px; top:0px; width:'+obj.w+'px; height:'+obj.h+'px; layer-background-color: #0000FF; z-index:1; overflow: hidden;">'); 
	document.writeln('<div id="'+obj.layer+'1" style="position:absolute; left:0px; top:0px; width:'+obj.w+'px; height:'+obj.h+'px; layer-background-color: #00FF00; z-index:2"></div>'); 
	document.writeln('<div id="'+obj.layer+'2" style="position:absolute; left:0px; top:'+obj.h+'px; width:'+obj.w+'px; height:'+obj.h+'px; layer-background-color: #FF0000; z-index:3"></div>'); 
	document.writeln('</div>'); 

	eval(obj.layer+"1.innerHTML = "+objname+".msg[0];");
	eval(obj.layer+"2.innerHTML = "+objname+".msg[1];");

	var time1 = (obj.speed*obj.h);
	for (var i=1;i<100;i++) {
		setTimeout("OnelineUp('"+objname+"')",time1);
		time1 = time1 + (obj.stop*obj.h)*2;
	}
}

function slideLineLoop(objname) {
	eval("obj = "+objname+";");
	obj.speed = obj.speed*200;

	document.writeln('<div id="'+obj.layer+'0" style="position:relative; left:0px; top:0px; width:'+obj.w+'px; height:'+obj.h+'px; layer-background-color: #0000FF; z-index:1; overflow: hidden;">'); 
	document.writeln('<div id="'+obj.layer+'1" style="position:absolute; left:0px; top:0px; width:'+obj.w+'px; height:'+obj.h+'px; layer-background-color: #00FF00; z-index:2"></div>'); 
	document.writeln('<div id="'+obj.layer+'2" style="position:absolute; left:0px; top:'+obj.h+'px; width:'+obj.w+'px; height:'+obj.h+'px; layer-background-color: #FF0000; z-index:3"></div>'); 
	document.writeln('</div>'); 

	eval(obj.layer+"1.innerHTML = "+objname+".msg[0];");
	eval(obj.layer+"2.innerHTML = "+objname+".msg[1];");

	var time1 = (obj.speed*obj.h);
	for (var i=1;i<100;i++) {
		setTimeout("SwapLine('"+objname+"')",i*obj.speed);
		time1 = time1 + (obj.speed*obj.h)*2;
	}
}

function OnelineUp(objname) {
	eval("obj = "+objname+";");

	for (var i=1;i<=obj.h;i++) {
		setTimeout("OneStepUp('"+objname+"')",i*obj.speed);
	}
	setTimeout("SwapLine('"+objname+"')",i*obj.speed);
}

function OneStepUp(objname) {
	eval("obj = "+objname+";");

	var t1 = getTop(obj.layer+"1");
	var t2 = getTop(obj.layer+"2");

	eval(obj.layer+"1"+".style.top = t1 - 1;");
	eval(obj.layer+"2"+".style.top = t2 - 1;");
	return;
}

function SwapLine(objname) {
	eval("obj = "+objname+";");

	var t1 = getTop(obj.layer+"1");
	var t2 = getTop(obj.layer+"2");

	if (t1 < t2) {
		eval(obj.layer+"1"+".style.top = t1 + ("+obj.h+" * 2);");
		eval(obj.layer+"2"+".style.top = 0;");
	}else {
		eval(obj.layer+"2"+".style.top = t2 + ("+obj.h+" * 2);");
		eval(obj.layer+"1"+".style.top = 0;");
	}
	ChgMsg(objname);
	return;
}

function ChgMsg(objname) {
	eval("obj = "+objname+";");

	var t1 = getTop(obj.layer+"1");
	var t2 = getTop(obj.layer+"2");

	if (obj.msg.length<=obj.next_no) obj.next_no = 0;

 	if (t1 > t2) {
		eval(obj.layer+"1"+".innerHTML = "+objname+".msg["+obj.next_no+"];");
	}else {
		eval(obj.layer+"2"+".innerHTML = "+objname+".msg["+obj.next_no+"];");
	}

	obj.next_no = obj.next_no + 1;
}

function getTop(layer) {
	return eval("parseInt("+layer+".style.top.substring(0,"+layer+".style.top.length-2));");
}

댓글목록

나이유미님의 댓글

나이유미 작성일

안되는건지 제가 못하는건지....ㅠㅠ;;;

Total 179건 3 페이지
Javascript 목록
번호 제목 글쓴이 조회 날짜
139 MintState 16175 11-17
138 MintState 18571 11-17
열람중
세로롤링 댓글+ 1
MintState 16194 11-17
136 MintState 15265 11-17
135 MintState 14802 11-17
134 MintState 16448 11-17
133 MintState 17357 11-17
132 MintState 17153 11-17
131 MintState 18188 11-17
130 MintState 17092 11-17
129 MintState 14931 11-17
128 MintState 15655 11-17
127 MintState 16446 11-17
126 MintState 16744 11-17
125 MintState 20183 11-17
124 MintState 17442 11-17
123 MintState 10891 11-17
122 MintState 16224 11-17
121 MintState 17137 11-17
120 MintState 10031 11-17
게시물 검색
모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™