Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

start button js

function init(){
imgObj = document.getElementById('myImage');
imgObj.style.position= 'relative';
imgObj.style.left = '0px';
}

function startStop(){
moveRight();
change();
}

function moveRight(){
imgObj.style.left = parseInt(imgObj.style.left) + 10 + 'px';
animate = setTimeout(moveRight,50); 
}

function change(){
var elem = document.getElementById("startButton");
if (elem.value=="Stop") elem.value = "Start";
else elem.value = "Stop";
}

function stop(){
clearTimeout(animate);
}

window.onload =init;
Comment

start button js

function init(){
imgObj = document.getElementById('myImage');
imgObj.style.position= 'relative';
imgObj.style.left = '0px';
}

function startStop(){
moveRight();
change();
}

function moveRight(){
imgObj.style.left = parseInt(imgObj.style.left) + 10 + 'px';
animate = setTimeout(moveRight,50); 
}

function change(){
var elem = document.getElementById("startButton");
if (elem.value=="Stop") elem.value = "Start";
else elem.value = "Stop";
}

function stop(){
clearTimeout(animate);
}

window.onload =init;
Comment

PREVIOUS NEXT
Code Example
Javascript :: gradle error react native 
Javascript :: map in javascript 
Javascript :: factorial program in javascript 
Javascript :: get last element in array javascript 
Javascript :: Find index using arrow function 
Javascript :: como checar valor do input checkbox angular 
Javascript :: Iterating set object javascript 
Javascript :: importing sha256 hashing algorithm 
Javascript :: textbox value length in javascript 
Javascript :: javascript parallax effect 
Javascript :: useEffect react dependency 
Javascript :: dynamic for loop react 
Javascript :: bundle 
Javascript :: react double render 
Javascript :: js color contrast ratio 
Javascript :: pass props in react 
Javascript :: javascript cheatsheet 
Javascript :: passing json as datasource to jasper report library 
Javascript :: delete node between indexes node list js 
Javascript :: javascript save as pdf 
Javascript :: react native spinkit 
Javascript :: password generator 
Javascript :: hot to start cypress 
Javascript :: react to pdf 
Javascript :: math.floor + roandom 
Javascript :: function js 
Javascript :: how to create new route in express 
Javascript :: wild card select jquery 
Javascript :: Button get specific input hidden value JQuery 
Javascript :: limit number in javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =