Forum Moderators: open
I have the following situation..I have my html page and after the <body> tag i have :
<script language="javascript" src="myjs.js"></script>. After this line I have another HTML content.
In the js file I create a <div id="d1"> filling it with some text using
document.getElementById('d1').innerHTML = "some div content"
then I set: document.getElementById('d1').style.display="none"
But only the content of the div deiappears and the place that it occupy stays i.e it acts as visibility:hidden.
All this Happens in Internet Explorer for Mac. can anybody tell me why i am getting this bug?
Thanks.
document.getElementById('d1').innerHTML = "some div content" document.getElementById('d1').style.display="none" you are not changing the content of the <div>, you are only changing the way it is displayed. The content is still there, all you did was make it invisible.
All this Happens in Internet Explorer for Mac. can anybody tell me why i am getting this bug?
You answered your question before you asked it!
No but seriously...
Have you tried the same script on another browser? If you don't see the same results, then it's a browser bug (yes, that browser has LOTS of those). But if you get the same results on IE (in windows) && firefox, then it's your code.
what is the "position" of this div set to? If it is absolute, then it is acting correctly.
Also, the only height you'll get is one that is set by you in the css code(if it was set). IIRC, you won't be able to get/store the browsers generated height.
- JS
Overflow:
I have found the overflow to work best for all browsers when a px height/width is given to it in css.
- JS
I tried creating it with DOM methods too. The same result. What should i do - give the dive 'class' attribute and define the class in css file or in <style></style> secction?
I'm sorry for my stupid questions, but i'm a newbie.
I'm sorry for my stupid questions, but i'm a newbie.
Never apologize for asking questions. Why would anyone waste their time helping people if they didn't want to?
Anyway, it looks like you are setting everything ok. Giving it a class would actually cause more browser headaces. Is it only on IE for the MAC that you are having problems, or is the same problem on other browsers as well?
- JS
My problem is just with IE for mac
Then it's not a problem with your code. Give up, it may not be possible to fix...
[quirksmode.org...]
This site is known for advanced browser work-arounds, and even he gave up on this browser!
Don't waste your time with something you can't fix.
- JS
of course you would have to undo those styles when you display block the code again.
that should mostly get rid of the space except for the 1px; not perfect but may look better.
probably more work than it's worth.
pretty brave to try and support IE5.2 but if you have a lot of OS9 users, there are not many other browsers, i think Camino may still support os9, but I could be wrong on that.