세로롤링
페이지 정보
작성자 MintState 댓글 1건 조회 16,193회 작성일 08-11-17 14:06본문
세로롤링
rolling.js
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));"); }
|
댓글목록
나이유미님의 댓글
나이유미 작성일안되는건지 제가 못하는건지....ㅠㅠ;;;