Resizing window and image buttons question

G

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.
 
G

GTi

GTi said:
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 ?
 
T

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top