// 카드정보 var msgInfo = {}; function setCardMessage(l, t, w, h, msg, color){ msgInfo.left = l; msgInfo.top = t; msgInfo.width = w; msgInfo.height = h; msgInfo.message = msg; msgInfo.color = color; } // 메세지 function showMsg(){ var txa = msgInfo.txa = document.createElement('textarea'); txa.readOnly = "readonly"; txa.style.resize = "none"; txa.style.overflow = "hidden"; txa.style.border = "0px"; txa.style.desabled = "disabled"; // font style txa.style.color = msgInfo.color; var dummy = "\n\n\n"; var ua = window.navigator.userAgent.toLowerCase(); if ( /iphone/.test(ua) || /android/.test(ua) || /opera/.test(ua) || /bada/.test(ua) ) { txa.style.fontSize = "40px"; }else{ txa.style.fontSize = "15px"; dummy += "\n\n"; } txa.style.background = "transparent"; // position txa.style.left = msgInfo.left + "px"; txa.style.top = msgInfo.top + "px"; txa.style.width = msgInfo.width + "px"; txa.style.height = msgInfo.height + "px"; txa.style.position = "absolute"; txa.style.zIndex = "1000"; txa.style.lineHeight = "1.2em"; txa.innerHTML = msgInfo.message; document.getElementById("Stage").appendChild(txa); setMaxScroll(); if(msgInfo.maxScroll > 0){ txa.innerHTML = dummy + msgInfo.message + dummy; setMaxScroll(); msgInfo.scrollInterval = setInterval(autoScroll, 100); } } function hideMsg(){ var txa = msgInfo.txa; if(txa){ clearInterval(msgInfo.scrollInterval); document.getElementById("Stage").removeChild(txa); } } function setMaxScroll(){ var txa = msgInfo.txa; if(txa){ txa.scrollTop = 1000; msgInfo.maxScroll = txa.scrollTop; txa.scrollTop = 0; } } function autoScroll(){ var txa = msgInfo.txa; if(txa){ if(txa.scrollTop == msgInfo.maxScroll){ txa.scrollTop = 0; }else{ txa.scrollTop++; } } }