Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139953

move the text downwards using css and setInterval

$
0
0

using CSS and setinterval, I need to move the text downwards with a "start" button. suppose, there is a text box and when I press the start button the text should move downwards and when I press stop button, it should stop the text motion.

<style>
.class1{ 
    position: relative; 
    padding-top: 10px; 
}
<body> 
    <p input id="para">Paragraph</p> 
    <button id="srt" onclick="start()">Start</button> 
    <button id="stp" onclick="stop()">Stop</button>
    <script> 
        var i=document.getElementById("para"); 
        setInterval(function start(){ 
            i.className="class1"; 
        },1000) 
    </script> 
</body>

Viewing all articles
Browse latest Browse all 139953

Trending Articles