鼠标感应抖动的按钮,速度可以自由调节

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

有什么问题请到<a href='/bbs/forums.php?fid=21'>论坛</a>中发表<br>

<!--# 特效来源:http://www.webjx.com/js -->

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

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

pos = 15;

TO = null;

function shake_funct2(object,speed)

{

obj = eval(object)

txt = clear_space(obj.value);

if (pos == 15)

{

txt = txt + " ";

pos = -15;

}

else

{

txt = " " + txt;

pos = 15;

}

obj.value = txt;

obj.style.width = parseInt(obj.style.width) + pos;

obj = object

sp = speed

TO = setTimeout("shake_funct2(obj,sp)",speed);

}

function clear_space(text)

{

while (text.substring(0,1) == " ")

{

text = text.substring(1,text.length);

}

while(text.substring(text.length-1,text.length) == " ")

{

text = text.substring(0,text.length-1);

}

return text;

}

function end_shake_funct2(object)

{

clearTimeout(TO);

obj = eval(object);

txt = clear_space(obj.value);

obj.value = txt;

//alert(pos);

if (pos == -15)

{

obj.style.width = parseInt(obj.style.width) +15;

}

pos = 15

}

// End -->

</script>

<form name=myform2>

<table border=0>

<tr><td>

一般抖动的按钮

</td>

<td align=center width=160>

<input type=button value = "一般速度" style="font-size:12;width:150" onmouseover="shake_funct2(this,100)" onmouseout="end_shake_funct2(this)">

</td></tr>

<tr><td>

快速抖动的按钮

</td>

<td align=center width=160>

<input type=button value = "更快速度" style="font-size:12;width:150" onmouseover="shake_funct2(this,50)" onmouseout="end_shake_funct2(this)">

</td></tr>

</Table>

</form>

[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

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