Shaking text

Written by @kerixa 25 February 2014

A simple script to shake a text int eh web page. You can customize its seed and other features

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.htmlbestcodes.com coded by: Kerixa Inc. -->
<!-- this script got from www.htmlbestcodes.com-Coded by: Krishna Eydat -->
<html>
<head></head>
<body>
<script>
var ie=document.all?1:0
var ns6=document.getElementById&&!document.all?1:0
var ns4=document.layers?1:0
var posleft=1
var idoftrembleobject="trembletext"
var trembleobject

function starttremble() {
    if (ie || ns4 || ns6) {
        if (ie) {
            trembleobject=eval("document.all."+idoftrembleobject+".style")
        }
        if (ns6) {
            trembleobject=idoftrembleobject
        }
        
	    dotremble()
    }
}
function dotremble() {
    posleft*=-1
    if (ie) {
	    trembleobject.posLeft+=posleft  
    }
    if (ns6) {
	    var newpos=parseInt(document.getElementById(trembleobject).style.left)+posleft
        document.getElementById(trembleobject).style.left=newpos
    }
    var timer=setTimeout("dotremble()",20)
}
onload=starttremble
</script>
<div id="tremblebox" style="position:relative">
<span id="trembletext" style="position:absolute;left:10px;top:30px;">
<font size=2 color=black face=Verdana>This is your shaking text</font>!
</span></div>
<br/><br/>
<br/>
<p><a target="_blank" href="http://www.htmlbestcodes.com/"><span style="font-size: 8pt; text-decoration: none">HTML Best Codes</span></a></p>
</body>
</html><a target='_blank' href='https://www.htmlbestcodes.com' style='font-size: 8pt; text-decoration: none'>Html Best Codes</a>                                                
                                            

Example:


About @kerixa

I am Krishna Eydat. I studied Software Engineering at University of Waterloo in Canada. I lead a few tech companies. I am passionate about the way we are connected. I would like to be part of something big or be the big deal!

K

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: TheDewalt, sahjahan, fk khan, Proper, Jenisha
advertisement 2