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

How to code your own resize events ?

P: n/a
I need to code my own resize event, and Im not sure how.

I have a DIV whose width I always want to be the browser height (the inner
pane, excluding the toolbars, status bar etc) - 200 points (say). I can't
use a height % for this, so as I understand it I need to code my own
onresize event.

Trouble is, I know almost nothing about javascript, so I dont know how to
get the browser window height or set the DIV height.
The solution should be portable if possible (ie. run on IE, Netscape,
Mozilla, etc).
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
No, you should not need any event for that. This is not the way how you
handle this sort of things. You can reach almost any resizing effect by
proper laying out your page. I recommend using html tables (<table>) for all
sorts of layout. Browsers know how to handle them well. For your particular
task place your <div> in a row with height=100%. Make another row with
height=200px on top of that and place there another <div>.

Even with a single <div> you can play with padding and margin attributes and
you might achieve your goal without any table. But still I would recommend a
table since different browser handle padding and margins differently.

Eliyahu

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
I need to code my own resize event, and Im not sure how.

I have a DIV whose width I always want to be the browser height (the inner
pane, excluding the toolbars, status bar etc) - 200 points (say). I can't
use a height % for this, so as I understand it I need to code my own
onresize event.

Trouble is, I know almost nothing about javascript, so I dont know how to
get the browser window height or set the DIV height.
The solution should be portable if possible (ie. run on IE, Netscape,
Mozilla, etc).

Nov 18 '05 #2

P: n/a
I want to avoid using HTML tables - W3C does not recommend this approach for
managing page layout. I'm trying to use styles exclusively.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
No, you should not need any event for that. This is not the way how you
handle this sort of things. You can reach almost any resizing effect by
proper laying out your page. I recommend using html tables (<table>) for all sorts of layout. Browsers know how to handle them well. For your particular task place your <div> in a row with height=100%. Make another row with
height=200px on top of that and place there another <div>.

Even with a single <div> you can play with padding and margin attributes and you might achieve your goal without any table. But still I would recommend a table since different browser handle padding and margins differently.

Eliyahu

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
I need to code my own resize event, and Im not sure how.

I have a DIV whose width I always want to be the browser height (the inner pane, excluding the toolbars, status bar etc) - 200 points (say). I can't use a height % for this, so as I understand it I need to code my own
onresize event.

Trouble is, I know almost nothing about javascript, so I dont know how to get the browser window height or set the DIV height.
The solution should be portable if possible (ie. run on IE, Netscape,
Mozilla, etc).


Nov 18 '05 #3

P: n/a
Hi Jez,

You might get some worthwhile ideas from Andy Smith's free code:

"The ResizeMonitor control raises server-side events when the user changes
their browser window size. "

http://www.metabuilders.com/Tools/ResizeMonitor.aspx

Ken

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
I need to code my own resize event, and Im not sure how.

I have a DIV whose width I always want to be the browser height (the inner
pane, excluding the toolbars, status bar etc) - 200 points (say). I can't
use a height % for this, so as I understand it I need to code my own
onresize event.

Trouble is, I know almost nothing about javascript, so I dont know how to
get the browser window height or set the DIV height.
The solution should be portable if possible (ie. run on IE, Netscape,
Mozilla, etc).


Nov 18 '05 #4

P: n/a
I wish you well in trying to avoid tables. Developers use tables not because
they love them, rather for the simple reason that with a table you can in a
number of minutes achieve what you have been trying to for hours and days
without tables.

It's not clear for me how is using styles connected to event handling that
you mentioned in your original post.

Eliyahu

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
I want to avoid using HTML tables - W3C does not recommend this approach for managing page layout. I'm trying to use styles exclusively.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
No, you should not need any event for that. This is not the way how you
handle this sort of things. You can reach almost any resizing effect by
proper laying out your page. I recommend using html tables (<table>) for all
sorts of layout. Browsers know how to handle them well. For your

particular
task place your <div> in a row with height=100%. Make another row with
height=200px on top of that and place there another <div>.

Even with a single <div> you can play with padding and margin attributes

and
you might achieve your goal without any table. But still I would recommend a
table since different browser handle padding and margins differently.

Eliyahu

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
I need to code my own resize event, and Im not sure how.

I have a DIV whose width I always want to be the browser height (the

inner pane, excluding the toolbars, status bar etc) - 200 points (say). I can't use a height % for this, so as I understand it I need to code my own
onresize event.

Trouble is, I know almost nothing about javascript, so I dont know how to get the browser window height or set the DIV height.
The solution should be portable if possible (ie. run on IE, Netscape,
Mozilla, etc).



Nov 18 '05 #5

P: n/a
Well, styles can dictate positioning and size as well as colours, fonts etc.
My DIV has a style which has a width property of 100%, but its the height
property that I'm having trouble with - I cannot use a % or hardcode a
specific number of pixels - I need to calculate it in a javascript onResize
event, based on the browser height.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eG**************@TK2MSFTNGP09.phx.gbl...
I wish you well in trying to avoid tables. Developers use tables not because they love them, rather for the simple reason that with a table you can in a number of minutes achieve what you have been trying to for hours and days
without tables.

It's not clear for me how is using styles connected to event handling that you mentioned in your original post.

Eliyahu

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
I want to avoid using HTML tables - W3C does not recommend this approach

for
managing page layout. I'm trying to use styles exclusively.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
No, you should not need any event for that. This is not the way how you handle this sort of things. You can reach almost any resizing effect by proper laying out your page. I recommend using html tables (<table>) for
all
sorts of layout. Browsers know how to handle them well. For your

particular
task place your <div> in a row with height=100%. Make another row with
height=200px on top of that and place there another <div>.

Even with a single <div> you can play with padding and margin
attributes and
you might achieve your goal without any table. But still I would recommend
a
table since different browser handle padding and margins differently.

Eliyahu

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
> I need to code my own resize event, and Im not sure how.
>
> I have a DIV whose width I always want to be the browser height (the

inner
> pane, excluding the toolbars, status bar etc) - 200 points (say). I

can't
> use a height % for this, so as I understand it I need to code my own
> onresize event.
>
> Trouble is, I know almost nothing about javascript, so I dont know

how to
> get the browser window height or set the DIV height.
> The solution should be portable if possible (ie. run on IE,

Netscape, > Mozilla, etc).
>
>



Nov 18 '05 #6

P: n/a
using divs and styles saves a LOT of time in the long run compared to tables. How often have you made a site that uses it's original interface. Typically I end up changing the interface at least once during development because it becomes apparent that a different design would work better. Design changes with divs and stylesheets can propogate across the whole site instead of having to change every table. Also, as I get better with divs, styling becomes faster than with tables. To address the original question, find a way to do this with percentages. Download mozilla and use their dom inspector it really, really helps when designing layouts.

"JezB" wrote:
Well, styles can dictate positioning and size as well as colours, fonts etc.
My DIV has a style which has a width property of 100%, but its the height
property that I'm having trouble with - I cannot use a % or hardcode a
specific number of pixels - I need to calculate it in a javascript onResize
event, based on the browser height.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eG**************@TK2MSFTNGP09.phx.gbl...
I wish you well in trying to avoid tables. Developers use tables not

because
they love them, rather for the simple reason that with a table you can in

a
number of minutes achieve what you have been trying to for hours and days
without tables.

It's not clear for me how is using styles connected to event handling

that
you mentioned in your original post.

Eliyahu

"JezB" <je***********@blueyonder.co.uk> wrote in message
news:es**************@TK2MSFTNGP12.phx.gbl...
I want to avoid using HTML tables - W3C does not recommend this approach

for
managing page layout. I'm trying to use styles exclusively.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
> No, you should not need any event for that. This is not the way how you > handle this sort of things. You can reach almost any resizing effect by > proper laying out your page. I recommend using html tables (<table>) for all
> sorts of layout. Browsers know how to handle them well. For your
particular
> task place your <div> in a row with height=100%. Make another row with
> height=200px on top of that and place there another <div>.
>
> Even with a single <div> you can play with padding and margin attributes and
> you might achieve your goal without any table. But still I would

recommend
a
> table since different browser handle padding and margins differently.
>
> Eliyahu
>
> "JezB" <je***********@blueyonder.co.uk> wrote in message
> news:OH**************@TK2MSFTNGP11.phx.gbl...
> > I need to code my own resize event, and Im not sure how.
> >
> > I have a DIV whose width I always want to be the browser height (the
inner
> > pane, excluding the toolbars, status bar etc) - 200 points (say). I
can't
> > use a height % for this, so as I understand it I need to code my own
> > onresize event.
> >
> > Trouble is, I know almost nothing about javascript, so I dont know how to
> > get the browser window height or set the DIV height.
> > The solution should be portable if possible (ie. run on IE, Netscape, > > Mozilla, etc).
> >
> >
>
>



Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.