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 Wednesday, January 19, 2011
Core Hunting Lands In Al
Javascript.internet.com for your buttons to call the attention of your users with their unusual movements.
Try it:
Code:
First, the Script, this can place anywhere, although I recommend you always put in \u0026lt;HEAD> document, but do this in a blog is very complicated, so I add it straight to the beginning of the entry into the HTML and it works:
pos = 15;
TO = null;
shake_funct2 function (object, speed) TO = null;
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.
{
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.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment