By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,688 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,688 IT Pros & Developers. It's quick & easy.

Resizing window and image buttons question

P: n/a
GTi

Q1)
I have searched around after a cross browser JavaScript that can resize
my popup window with a specified width and height.
I want to set the width and height of the browsers document content.
Does anyone have a nice script that actual set the inner width/height
so it is equal on browsers ( IE/FF )

function SetWindowSize(winWidth,winHeight)
{
var d=document;
if (typeof window.innerWidth!='undefined')
{
window.innerWidth = winWidth;
window.innerHeight = winHeight;
}
else
{
if (d.documentElement && typeof
d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0)
{
d.documentElement.clientWidth = winWidth;
d.documentElement.clientHeight = winHeight;
}
else
{
if (d.body && typeof d.body.clientWidth!='undefined')
{
d.body.clientWidth = winWidth;
d.body.clientHeight = winHeight;
}
}
}
}
Q2)
How can I specify the partion of a image I want to display using CSS.
Say I have one image with the size 100x200.
But I only want to display the 0,0,100,100 (x,y,w,h)
I want to use this to create image buttons with different images on
normal, hover, mouse down, disabled etc. with only one image.
With this I want to pre-cache the images since it is already loaded the
first time.

Oct 11 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
GTi
GTi wrote:
Q1)
I have searched around after a cross browser JavaScript that can resize
my popup window with a specified width and height.
I want to set the width and height of the browsers document content.
Does anyone have a nice script that actual set the inner width/height
so it is equal on browsers ( IE/FF )

function SetWindowSize(winWidth,winHeight)
{
var d=document;
if (typeof window.innerWidth!='undefined')
{
window.innerWidth = winWidth;
window.innerHeight = winHeight;
}
else
{
if (d.documentElement && typeof
d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0)
{
d.documentElement.clientWidth = winWidth;
d.documentElement.clientHeight = winHeight;
}
else
{
if (d.body && typeof d.body.clientWidth!='undefined')
{
d.body.clientWidth = winWidth;
d.body.clientHeight = winHeight;
}
}
}
}
Q2)
How can I specify the partion of a image I want to display using CSS.
Say I have one image with the size 100x200.
But I only want to display the 0,0,100,100 (x,y,w,h)
I want to use this to create image buttons with different images on
normal, hover, mouse down, disabled etc. with only one image.
With this I want to pre-cache the images since it is already loaded the
first time.
Anyone ?

Oct 14 '06 #2

P: n/a
GTi
Maybe this is the wrong group?

GTi wrote:
GTi wrote:
Q1)
I have searched around after a cross browser JavaScript that can resize
my popup window with a specified width and height.
I want to set the width and height of the browsers document content.
Does anyone have a nice script that actual set the inner width/height
so it is equal on browsers ( IE/FF )

function SetWindowSize(winWidth,winHeight)
{
var d=document;
if (typeof window.innerWidth!='undefined')
{
window.innerWidth = winWidth;
window.innerHeight = winHeight;
}
else
{
if (d.documentElement && typeof
d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0)
{
d.documentElement.clientWidth = winWidth;
d.documentElement.clientHeight = winHeight;
}
else
{
if (d.body && typeof d.body.clientWidth!='undefined')
{
d.body.clientWidth = winWidth;
d.body.clientHeight = winHeight;
}
}
}
}
Q2)
How can I specify the partion of a image I want to display using CSS.
Say I have one image with the size 100x200.
But I only want to display the 0,0,100,100 (x,y,w,h)
I want to use this to create image buttons with different images on
normal, hover, mouse down, disabled etc. with only one image.
With this I want to pre-cache the images since it is already loaded the
first time.

Anyone ?
Oct 21 '06 #3

P: n/a
TC
(top-posted for consistency)

Q2 asks about CSS, so that would be offtopic here.

As for Q1, you show some script, but you don't say whether it works or
not. People often won't bother to guess, they'll just move on to the
next question.

Here's a tip for how to ask your question more effectively:
http://tc2.atspace.com/0012-UsingUsenet.htm#PostBody

Please note that you should bottom-post (not top-post) in this group.
http://en.wikipedia.org/wiki/Top-posting

HTH,
TC (MVP MSAccess)
http://tc2.atspace.com
GTi wrote:
Maybe this is the wrong group?

GTi wrote:
GTi wrote:
Q1)
I have searched around after a cross browser JavaScript that can resize
my popup window with a specified width and height.
I want to set the width and height of the browsers document content.
Does anyone have a nice script that actual set the inner width/height
so it is equal on browsers ( IE/FF )
>
function SetWindowSize(winWidth,winHeight)
{
var d=document;
if (typeof window.innerWidth!='undefined')
{
window.innerWidth = winWidth;
window.innerHeight = winHeight;
}
else
{
if (d.documentElement && typeof
d.documentElement.clientWidth!='undefined' &&
d.documentElement.clientWidth!=0)
{
d.documentElement.clientWidth = winWidth;
d.documentElement.clientHeight = winHeight;
}
else
{
if (d.body && typeof d.body.clientWidth!='undefined')
{
d.body.clientWidth = winWidth;
d.body.clientHeight = winHeight;
}
}
}
}
>
>
Q2)
How can I specify the partion of a image I want to display using CSS.
Say I have one image with the size 100x200.
But I only want to display the 0,0,100,100 (x,y,w,h)
I want to use this to create image buttons with different images on
normal, hover, mouse down, disabled etc. with only one image.
With this I want to pre-cache the images since it is already loaded the
first time.
Anyone ?
Oct 21 '06 #4

P: n/a
TC said the following on 10/21/2006 1:06 PM:
(top-posted for consistency)
There is nothing "consistent" about top posting in clj. The preferred
posting style here, as stated in the FAQ somewhere, is to interleave the
replies.

<snip>
Please note that you should bottom-post (not top-post) in this group.
http://en.wikipedia.org/wiki/Top-posting
Then why did you top post?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 21 '06 #5

P: n/a
TC

Randy Webb wrote:
blah blah blah blah

I'm sure the OP will benefit from your useful additional comments.

TC (MVP MSAccess)
http://tc2.atspace.com

Oct 22 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.