onclick必须点击两次才能触发(onclick has to be clicked twice to fire)
除非点击两次,否则我的onclick函数将不会触发。 我对javascript很新,但到目前为止,我在var obj行中移动,并将==“none”更改为“none”?“empty”; 这两件事我都不明白,但看到其他人解决这个问题。 都没有工作。
function showDiv(id){
var obj = document.getElementById(id);
if( obj.style.display == "none") {
obj.style.display='block'
}
else{
obj.style.display='none'
}
}
Roughly 2-3 months.
My onclick function won't fire unless it is clicked twice. I am very new to javascript but so far i trie moving around the var obj line, and changing the =="none" to "none"?"empty"; which are both things I didn't understand but saw other people did to fix this pr