Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>setting a minimum size for a modal dialog

setting a minimum size for a modal dialog

davidklonski
06-27-2004, 06:21 PM
Hi people

I am using window.showModalDialog() to open a modal dialog window.
I would like to set a minimum size for the window (width & height).

I set the following:

<body onresize="pageResize()">
...
</body>

In a javascript file I have:

function pageResize() {
var windowWidth = document.body.clientWidth;
var windowHeight = document.body.clientHeight;

if (windowWidth < 100) {
document.body.clientWidth = 100;
}
if (windowHeight < 100) {
document.body.clientHeight = 100;
}
}

I get an error saying: "Object doesn't support this action" for line settings:

document.body.clientWidth = 100;


Is there another way of doing that?

thanks in advance

neofibril
06-28-2004, 11:20 AM
Properties such as clientWidth are read-only.

If I recall correctly, once opened, the width and height properties of an html dialog can only be modified from an html application.

They can be set initially in the showModalDialog call, however.

davidklonski
06-28-2004, 01:10 PM
I solved the problem.
Taken from the MSDN library (concerning the usage of resizeTo):

This method does not work on dialog windows. In order to move or size a dialog window, manipulate the dialogHeight, dialogWidth, dialogTop, and dialogLeft properties.

This is my final solution:

function pageResize() {
var currentHeight = 0;

// the frames are set one on top of the other - so I am calculating the total height
for (i=0; i<parent.frames.length; i++) {
currentHeight += parent.frames[i].document.body.clientHeight;
}
var currentWidth = parent.frames[0].document.body.clientWidth;

if (currentWidth < 300) {
parent.dialogWidth = "300px";
}
if (currentHeight < 300) {
parent.dialogHeight = "300px";
}
}


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

JS Validation obsolete in the face of Server-Side methods?
Javascript Pop up function
Slide show transitions effect
I'm a newbie...please!
how to write coding in javascript
The prototype property
.js file doesn't work as external file...

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics