Link to home
Start Free TrialLog in
Avatar of ferman-k
ferman-kFlag for United Kingdom of Great Britain and Northern Ireland

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

<html>
hello world
</html>

Open in new window

Avatar of Tapan Pattanaik
Tapan Pattanaik
Flag of India image

hi ferman-k,

                  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
Avatar of Chad Haney
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>

Open in new window

Avatar of ferman-k

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

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

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Tapan Pattanaik
Tapan Pattanaik
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you have position defined as either absolute or relative and left defined?
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