How to change style / styles with document.getElementById for IE7 ?

I want to change DIV-styles through javascript with the use of document.getElementById
This works for IE6 and FireFox but for IE7 it does not work.
It seems that IE7 only accepts a style-change once, when you add another style for the same id it does not work or simply disappears.


document.getElementById('ctl00_mainContent_UcCatalog1_cart') = '';
document.getElementById('ctl00_mainContent_UcCatalog1_cart').style.height = '200px'; //does not work for IE7
document.getElementById('ctl00_mainContent_UcCatalog1_cart').style.overflow = 'hidden'; //does not work for IE7

Open in new window

Who is Participating?
geertbroConnect With a Mentor Author Commented:
It had somethinh to do with the Doctype but also on the other hand rendering in IE7.
I fixed it with providing the correct Doctype, and added sufficient styling & javascript-workarounds.
erikTsomikSystem Architect, CF programmer Commented:
it works fine for me . try this
<div id="ddd" onmouseover="c ();" onmouseout="c2 ();">HEllo</div>

<script language="javascript">
function c () {
document.getElementById('ddd').style.overflow = 'hidden';

function c2 () {
document.getElementById('ddd').style.overflow = 'visible';
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.