I want to change this code to the form of a callback function
oBtn1.onclick=function(){
oDiv1.style.display="inline-block";
setTimeout("document.getElementById("div1").style.display = "none";", 5000)
}
changed to this without any reaction or error
oBtn1.onclick=function(callback){
oDiv1.style.display="inline-block";
var callback = function (){
document.getElementById("div1").style.display="none";
}
setTimeout(callback(),5000);
}
other people say that if you try it like this or not, there is no response, so how should you change it?
var callback = function (){
document.getElementById("div1").style.display="none";
}
oBtn1.onclick=doClick(callback);
function doClick(callback){
oDiv1.style.display="inline-block";
setTimeout(callback(),5000);
}