我需要使這個功能工作。它應該改變div fullhouse和其他兩個div上的顯示,並將類別更改爲從上到下的餘量。 該函數僅適用於不顯示任何內容。Javascript的更多功能onclick和ClassName
預先感謝您
function fullhouse()
{
document.getElementById("fullhouse").style.display = "none";
document.getElementsByClassName("header-container").style.margin-top = "0px";
document.getElementsByClassName("top-icon-menu").style.margin-top = "0px";
}
'getElementsByClassName' does not return a single元素,但一個HTMLCollection - 你必須遍歷那裏的項目,併爲每個項目設置樣式。而'.style.margin-top'也是錯誤的 - 這將是一個數學運算,'.style.margin'減去'top' - 它需要是'.style.marginTop'。 – CBroe 2014-08-27 12:03:01