“Mulai Tombol JS” Kode Jawaban

Mulai Tombol 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;
Murad Samadzade

Mulai Tombol 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;
Murad Samadzade

Jawaban yang mirip dengan “Mulai Tombol JS”

Pertanyaan yang mirip dengan “Mulai Tombol JS”

Lebih banyak jawaban terkait untuk “Mulai Tombol JS” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya