Solved

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

Posted on 2008-10-02
2
1,218 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
Several part series to implement Internet Explorer 11 Enterprise Mode
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

734 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