图片感应鼠标的大小变换

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

<!--要完成此效果需要两个步骤

第一步:把如下代码加入到<head>区域中-->

<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">

<!-- Begin

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;

// End -->

</script>

<!--第二步:把如下代码加入到<body>区域中-->

<div id="menucont">

<a href="#" id="a1" class="menulinks" title="what's new">what's new</a><br>

<a href="#" id="a2" class="menulinks" title="about this site">about this site</a><br>

<a href="#" id="a3" class="menulinks" title="dhtml scripts">dhtml scripts</a><br>

<a href="#" id="a4" class="menulinks" title="dhtml tutorials">dhtml tutorials</a><br>

<a href="#" id="a5" class="menulinks" title="dhtml links">dhtml links</a><br>

<a href="#" id="a6" class="menulinks" title="promote this site">promote this site</a><br>

<a href="#" id="a7" class="menulinks" title="contact us">contact us</a>

</div>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航