Saturday, October 10, 2009

Mobile character result achieves in condition column

When everybody browses a website, the literal one after another of mobile condition column from left appear right, the eye that lets you has too many visitors or business to deal with, you also want to make your webpage is having same effect, we achieve this result now through the application of JavaScript program, we come to anatomize below this kind of dynamic effect is how arise.

The train of thought that achieves this kind of result is: Endow with the character that should present to a variable first, install a function, every other plays a character on condition column for some time, the character increases by degrees appear, when literal length is equal to the length of whole word, make its are 0, play a character afresh, ceaseless loop can get this kind of result.

Below, we will have a look at source program.
<script Language="JavaScript ">Var Msg = " welcomes to 5D multimedia! ! ";
/ / Msg variable is the character that set condition column should appear (a word)Var Interval = 120
/ / length of character of how many millisecond increases set interval, it is 120 millisecond hereVar Seq=0;
/ / the literal length that represents trendsFunction Scroll() {Len = Msg.length;Window.status = Msg.substring(0, seq+1);
/ / literal character is added oneSeq++;
/ / the length of dynamic character is added oneIf (Seq >= Len) {Seq = 0;Window.status = '';Window.setTimeout("Scroll();" , interval);
}
/ / if dynamic character length and whole word are same, the length of dynamic character is set for 0, had come afreshElseWindow.setTimeout("Scroll();" , interval);
}
Scroll();
</script>

The effect that can have afore-mentioned source code beat as follows into the <body></body> label of Html file:


No comments:

Post a Comment