Solved

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

Posted on 2008-10-02
2
1,220 Views
Last Modified: 2013-12-08
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.

Code:


   
document.getElementById('ctl00_mainContent_UcCatalog1_cart').style.top = '';
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

0
Comment
Question by:geertbro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22624938
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.height='100px';
document.getElementById('ddd').style.overflow = 'hidden';
}

function c2 () {
document.getElementById('ddd').style.height='500px';
document.getElementById('ddd').style.overflow = 'visible';
}
</script>
0
 
LVL 1

Accepted Solution

by:
geertbro earned 0 total points
ID: 22789857
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.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question