Wednesday, 27 July 2011

Tulisan yang mengetik sendiri

Dashboard > Design > Page Element > Add Gadget > HTML JAvascript 

copy and paste code kat bawah ni.. 

<div class="widget HTML" id="HTML10">
<h2 align="center" class="title">
</h2>
<div class="widget-content">
<style type="text/css">
</style>
<form name="news">
<div align="center">
<textarea cols="50" name="news2" rows="1" wrap="virtual"></textarea>

</div>
</form>
<script language="javascript">
var newsText = new Array();
newsText[1] = "masukan kata-kata anda";
newsText[2] = "masukan kata-kata anda";
var ttloop = 1;  
var tspeed =70; 
var tdelay = 1000;
var dwAText, cnews=0, eline=0, cchar=0, mxText;
function doNews() {
  mxText = newsText.length - 1;
  dwAText = newsText[cnews];
  setTimeout("addChar()",1000)
}
function addNews() {
  cnews += 1;
  if (cnews <= mxText) {
    dwAText = newsText[cnews];
    if (dwAText.length != 0) {
      document.news.news2.value = "";
      eline = 0;
      setTimeout("addChar()",tspeed)
    }
  }
}
function addChar() {
  if (eline!=1) {
    if (cchar != dwAText.length) {
      nmttxt = ""; for (var k=0; k<=cchar;k++) nmttxt += dwAText.charAt(k);
      document.news.news2.value = nmttxt;
      cchar += 1;
      if (cchar != dwAText.length) document.news.news2.value += "|";
    } else {
      cchar = 0;
      eline = 1;
    }
    if (mxText==cnews && eline!=0 && ttloop!=0) {
      cnews = 0; setTimeout("addNews()",tdelay);
    } else setTimeout("addChar()",tspeed);
  } else {
    setTimeout("addNews()",tdelay)
  }
}
doNews()
</script>
</div>
</div>

Text  masukan kata-kata anda boleh replace ngan text sendiri..

try it~ :)

No comments: