Wednesday, January 19, 2011

Core Hunting Lands In Al

Pet: A cat in your Web

Want some buttons that shake like crazy as you pass the mouse over them, here I have a little script I found in


Try it:



Code:

\u0026lt;SCRIPT LANGUAGE="JavaScript">
pos = 15;
TO = null;
shake_funct2 function (object, speed)
{obj = eval ( object)
txt = clear_space (obj.value)   {
   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}}


\u0026lt;/ script>

Now Buttons these if you can paste it where you want to see them:


\u0026lt;input onmouseout = "end_shake_funct2 (this)" onmouseover = "shake_funct2 (this, 100)" type = "button" value = "Move!" />
\u0026lt;input onmouseout = "end_shake_funct2 (this)" onmouseover = "shake_funct2 (this, 50)" type = "button" value = "Faster!" />


I think it works in all browsers, but I'm really not sure, what is important to keep in mind is that the function Shake_funct2 also want to move element has a numeric parameter that indicates the time Waiting in the movement for which the larger this value slower anger and vice versa.





0 comments:

Post a Comment