如何使实际盒子比其他盒子大?
|
我是javascript新手,但遇到了问题。我希望实际的(功能updateBoxes)框[boxIx]大于其他框,但我似乎找不到有效的代码。我尝试过box [boxIx] .size = \“ 100px \”; box [boxIx] .style.size = \“ 100px \”;没有结果。这是我的代码;
function init() {
box = document.getElementById(\"boxes\").getElementsByTagName(\"div\");
for (var i=0; i<box.length; i++) {
box[i].style.left = 70*i+\"px\";
} // End for
boxIx = box.length - 8;
updateBoxes();
} // End init
function browseLeft() {
if (boxIx > 0) boxIx = boxIx - 1;
updateBoxes();
}
// End browseLeft
function browseRight() {
if (boxIx < box.length-1) boxIx = boxIx + 1;
updateBoxes();}
// End browseRight
**function updateBoxes() {
box[boxIx].style.backgroundColor =\"#CCC\";
box[boxIx].style.top = \"20px\";
box[boxIx].style.zIndex = 9;**
var z = 8;
for (var i=boxIx-1; i>=0; i--) {
box[i].style.backgroundColor =\"#666\";
box[i].style.top = \"0px\";
box[i].style.zIndex = z;
z = z - 1;
} // End for
z = 8;
for (var i=boxIx+1; i<box.length; i++) {
box[i].style.backgroundColor = \"#666\";
box[i].style.top = \"0px\";
box[i].style.zIndex = z;
z = z - 1;
} // End for
} // End browseLeft
没有找到相关结果
已邀请:
1 个回复
茂坦湿床够