469,290 Members | 1,887 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

showModalDialog leaves gap at right hand edge

Hi,

I've come across what appears to be a bug in the rendering engine of internet explorer when a document is opened by
showModalDialog. Basically any elements that should render to the right hand edge of the window (i.e. Horizontal rules,
100% tables) fall short by around 15 - 20 pixels or so. I'm currently using internet explorer 6 and have created two
simple pages to demonstrate the behavior. My original pages were much more complicated but the effect remains even with
the most basic of documents.

Create a file called Dialog.html and put the following lines within it.

<HTML>
<HEAD>
</HEAD>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<hr>
</BODY>
</HTML>

Save it and then open it in internet explorer. The horizontal line goes from left to right perfectly to the right hand
border.

Now create a page called MainPage.html with the same folder as the previous page. Within it have this code;

<HTML>
<HEAD>
</HEAD>
<BODY>
<script language="Javascript">
window.showModalDialog('dialog.html','','dialogWid th:540px;dialogHeight:450px');
</script>
</BODY>
</HTML>
Now open MainPage.html with internet explorer and the dialog that appears will not show the HR rule to the right hand
edge, it falls short by around 20 pixels.

The same effect appears with tables that are 100%, they finish before the right hand margin and if they have a
background colour set it will look quite messy. My problem for one of our pieces of intranet software is that we have a
corporate banner that must appear at the top of every page. On dialog pages the banner falls short of the edge by a very
noticeable amount and is unacceptable.

I've coded a work around that basically checks if the current page is a dialog page and if it is it adjusts the table to
make it bigger, here's the code;

if(typeof(self.window.dialogWidth)!="undefined")
window.document.all.SmallBannerTable.width=self.wi ndow.dialogWidth;
So if it's a dialog it resizes the table to the dialog width. Actually it's sizes it a little too wide but I'll fix
that very shortly.

So my question for anyone that knows,

Is this a bug ? or am missing something that I should be doing?
Steve
Remove 'TheCompany' in email address to give correct version.
Jul 20 '05 #1
2 4964
On Mon, 08 Sep 2003 12:08:04 +0100, Steve
<so*****@nelson.TheCompanypamarco.co.uk> wrote:
So my question for anyone that knows,

Is this a bug ? or am missing something that I should be doing?


It's space reserved for the scrollbar, use CSS to ensure it's not
there.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #2
Ahh, well that explains it. Still seems a bit odd that the behavior isn't the same as normal windows, i.e. it should fit
to the end when no scroll bar and adjust itself when there is a scroll bar, like normal pages do. The dialogs I present
to users are generated by PHP and some may require scroll bars and some may not depending upon the amount of data to
display.

Would your CSS fix just ensure no scroll bar is present (which won't work for my pages) or are you setting some other
property ?

Thanks for your input,

Steve

On Mon, 08 Sep 2003 11:16:53 GMT, ji*@jibbering.com (Jim Ley) wrote:
On Mon, 08 Sep 2003 12:08:04 +0100, Steve
<so*****@nelson.TheCompanypamarco.co.uk> wrote:
So my question for anyone that knows,

Is this a bug ? or am missing something that I should be doing?


It's space reserved for the scrollbar, use CSS to ensure it's not
there.

Jim.


Remove 'TheCompany' in email address to give correct version.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by csgraham74 | last post: by
5 posts views Thread by bruno | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.