good day! when i click a button, this codes will be executed (tested, its working)

var cart=document.getElementById('cart');
cart.innerHTML=cart.innerHTML + document.getElementById('name'+cartNum).innerHTML + "(" + qty + ")" + "<br>";

this is the style of my cart

}
#cart {
    overflow:auto;
    border:solid;
    height:500;
    margin-left:10px;
    margin-right:10px;
    margin-top:20px;
    margin-bottom:0;
    font-size: 12px;
    text-align: left;
    font-family: Verdana, Geneva, sans-serif;
    background-image:url(images/side.gif);
    background-repeat:no-repeat;
}

my problem is, the overflow which i set to auto is not working. the div keeps on enlarging its height everytime i click the button. seems like it has a conflict with innerhtml? please help me. replies are REALLY appreciated.

You forgot to add the unit to the value and your CSS is not entirely correct, use the following:

#cart {
overflow:auto;
border:1px solid red;
height:500px;
margin-left:10px;
margin-right:10px;
margin-top:20px;
margin-bottom:0px;
font-size: 12px;
text-align: left;
font-family: Verdana, Geneva, sans-serif;
background-image:url('images/side.gif');
background-repeat:no-repeat;
}

~G

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.