107、文字的随机伸缩变化

107、文字的随机伸缩变化

脚本说明:

把如下代码加入<body>区域中

<style type="text/css">

.menulinks {position:relative;}

#menucont a{color:#006699; font-weight:bold; text-decoration:none;}

#menucont a:hover{color:#ff0000; font-weight:bold; text-decoration:underline overline; text-transform: uppercase;}

</style>

 

<SCRIPT LANGUAGE="JavaScript">

nSpace=5   // how many space maximum between each letter

nSpeed=100 // the speed of the animation

timerLSM=null;

function LetterSpacingMenu() {

  if(document.getElementById){

  lnks = Math.floor(Math.random()*lnk.length);

  letterSpacing = Math.floor(Math.random()*nSpace);

  lnk[lnks].style.letterSpacing = letterSpacing + "px";

  timerLSM = setTimeout("LetterSpacingMenu()", nSpeed);

  }

}

function StopMenu() {

  if(document.getElementById) {

  clearTimeout(timerLSM);

  for(i=0;i<lnk.length;i++)

  lnk[i].style.letterSpacing = 0 + "px";

  }

}

function LSMenuInit() {

  if(document.getElementById) {

  lnk = document.getElementById("menucont").getElementsByTagName("a");

  cnt = document.getElementById("menucont");

  cnt.style.textAlign= "center";

  cnt.onmouseover=StopMenu;

  cnt.onmouseout=LetterSpacingMenu;

  LetterSpacingMenu();

  }

}

onload=LSMenuInit;

 

<!-- Begin

 

//  End -->

</script>

<div id="menucont">

  <!--  Put all links between <center> </center> to get those links align center for older browser -->

  <a href="#" id="a1" class="menulinks">拉登可能已被炸死 塔利班欲降遭拒</a><br>

  <a href="#" id="a2" class="menulinks">万米高空驾机遇险 我空军飞行员安全着陆 </a><br>

  <a href="#" id="a3" class="menulinks">张家界建“世界第一电梯” 明年元旦试运行 </a><br>

  <a href="#" id="a4" class="menulinks">辽宁首例注射死刑 5大具体行刑细节被揭开</a><br>

  <a href="#" id="a5" class="menulinks">怕拉登割须剃发出逃 飞机喊话重金悬赏捉拿 </a><br>

  <a href="#" id="a6" class="menulinks">“撞人”事件有隐情</a><br>

  <a href="#" id="a7" class="menulinks">李连杰当时并未在车中</a>

</div>

 

Write a comment

Comments: 0