469,926 Members | 2,533 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Enable scrolling in Modal Dialog

Joe
Is there a way to enable scrolling in a modal dialog box even if the
call to open the modal has "scroll:no"? I am looking to dynamically
size the modal dialog box for starters and if the modal is greater
than 400px in height, I want turn on the scroll bars otherwise I don't
want to turn them off.

CODE IN MY PARENT WINDOW.....
function modal()
{
window.showModalDialog("modal.htm", "docForm",
"center:yes;resizable:no;scroll:no;status:no;" );
}
CODE IN THE MODAL DIALOG TO AUTO RESIZE AND TURN ON SCROLL BARS IF
NEEDED....
<script language="JavaScript">
function AutoSizeModal()
{
var w = document.getElementById('Content').scrollWidth;
var h = document.getElementById('Content').scrollHeight;
if(h > 400)
{
var h = 400;
//Enable scrollbars here
}
var width = eval(w + 10);
var height = eval(h + 28);
window.dialogWidth = width+"px";
window.dialogHeight = height+"px";
}
</script>
</head>
<body onLoad="AutoSizeModal()">
<table width="300" border="0" id="Content">
<tr>
<td>
test
</td>
</tr>
</table>
</body>
</html>
Jul 20 '05 #1
2 10875
Joe wrote:
Is there a way to enable scrolling in a modal dialog box even if the
call to open the modal has "scroll:no"? I am looking to dynamically
size the modal dialog box for starters and if the modal is greater
than 400px in height, I want turn on the scroll bars otherwise I don't
want to turn them off.


Embed the content in an iframe.

--
Alex
Jul 20 '05 #2
Joe
Alex Fitzpatrick <al*********************@videotron.nospam.ca> wrote in message news:<b5*********************@wagner.videotron.net >...
Joe wrote:
Is there a way to enable scrolling in a modal dialog box even if the
call to open the modal has "scroll:no"? I am looking to dynamically
size the modal dialog box for starters and if the modal is greater
than 400px in height, I want turn on the scroll bars otherwise I don't
want to turn them off.


Embed the content in an iframe.

That might work.... I would also need to know how to get the size of
the iframe src so I can calculate the height and width of the content
that is being displayed. Do you know how to grab an ID from the src
file of an iframe?
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by martin de vroom | last post: by
2 posts views Thread by Gilles T. | last post: by
3 posts views Thread by Andrew | last post: by
7 posts views Thread by Mark Goldin | last post: by
2 posts views Thread by Guadala Harry | last post: by
10 posts views Thread by Guadala Harry | last post: by
1 post views Thread by NRM | last post: by
2 posts views Thread by sthrudel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.