skip to Main Content

Javascript – how do I hide an element depending on the variable?

num=1 document.getElementById("Num").innerHTML = num //button to increase/decrease num function next() { num++ document.getElementById("Num").innerHTML = num } function before() { num-- document.getElementById("Num").innerHTML = num } //hide and show asdf if (num=1){ document.getElementById("asdf").style.visibility = "hidden"; } else { document.getElementById("asdf").style.visibility = "visible"; }…

VIEW QUESTION

Javascript – opening the window depending on the variable

<html> <body> <button onclick="previous()">previous</button> <button onclick="next()">next</button> <img src="https://th.bing.com/th/id/OIP.-d3JKGX5ZJ3Y3U7ybY8h8gHaE7?rs=1&pid=ImgDetMain" onclick="reDirect()"></img> <script> maxnum=4 num=0 function previous(){ if(num>0) { num++ } else{} } function next(){ if(num<maxnum){ num++ } else{} } function reDirect(){ if(num=0) { window.open("https://youtube.com"); } else{} } </script> </body> </html> I wanted…

VIEW QUESTION
Back To Top
Search