TOP

Click to Cancel

text noticscroll
Pop Kst

Administrator
บอร์ด :--> It Programmer :--> script :--> text noticscroll

170 Time : 2019-04-22


html

<div id="noticscroll"></div>

javascript

<script type="text/javascript"> 
 
var max=0;
function textlist()
{
max=textlist.arguments.length; for (i=0; i<max; i++) this=textlist.arguments;
}
tl=new textlist
(
"ยินดีต้อนรับทุกท่านเข้าสู่โลกแห่งความสุข "
);
var x=0; pos=0;
function getRandom(rmin, rmax)
{
var randomNum = Math.random() * (rmax-rmin);
return(Math.round(randomNum) + rmin);
}
x = getRandom(0,max-1);
var l=tl[x].length;
function textticker()
{
document.getElementById("noticscroll").innerHTML = tl[x].substring(0,pos)+"_";
if(pos++==l)
{
pos=0;
setTimeout("textticker()",2000);
x++;
if(x==max)
x=0;
l=tl[x].length;
} else
setTimeout("textticker()",30);
}
 
textticker();
 
</script>