<html> <head> <script type="text/javascript"> function moveleft() { document.getElementById('header').style.position="absolute"; document.getElementById('header').style.left="0"; } function moveback() { document.getElementById('header').style.position="relative"; } </script> </head> <body> <h1 id="header" onmouseover="moveleft()" onmouseout="moveback()"> Mouse over this text</h1> </body> </html>
Your Result:
Edit the code above and click to see the result.
W3Schools.com
- Try it yourself