我在網頁腳本中發現,允許展開div。JS中的語法是什麼意思?
function toggle(sDivId) {
var oDiv = document.getElementById(sDivId);
oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";
}
請告訴我的意思是這條線:(oDiv.style.display == "none") ? "block" : "none";
[條件(三元)運算符(https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Conditional_Operator) – Turnip