to get the dimension of my document.
// javascript
var screen_width = null;
var screen_width = null;
screen_width = document.body.offsetWidth;
alert('Get IT');
screen_height = document.body.offsetHeight;
document.forms[0].txt_width.value = screen_width;
document.forms[0].txt_height.value = screen_height;
But the above script will fire only once the first time when the page is loaded.
do to execute this script every time the user resize window of the browser, use the following code part
if (self.innerWidth)
{
frameWidth = self.innerWidth;
frameHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth)
{
frameWidth = document.documentElement.clientWidth;
frameHeight = document.documentElement.clientHeight;
}
else if (document.body)
{
frameWidth = document.body.clientWidth;
frameHeight = document.body.clientHeight;
}
else return;
if (self.screen.width < frameWidth *2 self.screen.height < frameHeight *2)
{
newWidth = self.screen.width/2;
newHeight = self.screen.height/2;
if (document.layers)
{
tmp1 = parent.outerWidth - parent.innerWidth;
tmp2 = parent.outerHeight - parent.innerHeight;
newWidth -= tmp1;
newHeight -= tmp2;
}
parent.window.resizeTo(newWidth,newHeight);
parent.window.moveTo(self.screen.width/4,self.screen.height/4);
}
else
{
alert('No resize necessary');
}
Subscribe to:
Post Comments (Atom)
ASP.NET MVC - Sport Facility Booking system
The project relies on some external service providers. Thus accessing them via their API requires authentication. An API Key need to be su...
-
The project relies on some external service providers. Thus accessing them via their API requires authentication. An API Key need to be su...
-
"The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, II...
-
“The file you are attempting to save or retrieve has been blocked from this Web site by the server administrators.” By default, Windows Shar...
No comments:
Post a Comment