ferman-k
asked on
shaking word
hi....
can anyone please give me right code for shaking these 'hello world' while i put the mouse over it!
find the code below please!
thank you
can anyone please give me right code for shaking these 'hello world' while i put the mouse over it!
find the code below please!
thank you
<html>
hello world
</html>
Here is a simple example
<html>
<head>
<script type="text/javascript">
var go=true;
var left = true;
var shakeMe;
function shakeText(doIt, who){
go=doIt;
shakeMe=who;
shake();
}
function shake(){
if(go){
var pos = shakeMe.style.left;
pos = pos.substring(0,pos.indexOf("px"));
if (left){
shakeMe.style.left = parseInt(pos) + 1;
left=false;
}else{
shakeMe.style.left = parseInt(pos) - 1;
left=true;
}
var t = setTimeout("shake()",50);
}
}
</script>
</head>
<body>
<span style="position:relative;left:0;" onmouseover="shakeText(true, this)" onmouseout="shakeText(false, this)">Hello</span>
</body>
</html>
ASKER
i have used same code you sent and the hello word was not makng any move at all.. what do you think the problem might be? please!
please find the included code
please find the included code
<html>
<head>
<script type="text/javascript">
var go=true;
var left = true;
var shakeMe;
function shakeText(doIt, who){
go=doIt;
shakeMe=who;
shake();
}
function shake(){
if(go){
var pos = shakeMe.style.left;
pos = pos.substring(0,pos.indexOf("px"));
if (left){
shakeMe.style.left = parseInt(pos) + 1;
left=false;
}else{
shakeMe.style.left = parseInt(pos) - 1;
left=true;
}
var t = setTimeout("shake()",50);
}
}
</script>
</head>
<body>
<span style="position:relative;left:0;" onmouseover="shakeText(true, this)" onmouseout="shakeText(false, this)">Hello</span>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you have position defined as either absolute or relative and left defined?
ASKER
in fact it was not what i wanted, but i consider it better,, the word is not shaking, it wiggling instead, which it lovely and i like more. ;-)
i appreciate your guide, thank you
i appreciate your guide, thank you
Follow the step by step procedure in the given below link and it will display shaking text in the browser.
Shaking Text :
http://www.hypergurl.com/shakingtext.html
Thanks.
Tapan Pattaniak