473,566 Members | 2,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to code your own resize events ?

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
6 3693
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.u k> wrote in message
news:OH******** ******@TK2MSFTN GP11.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
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.co m> wrote in message
news:eb******** ******@TK2MSFTN GP10.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.u k> wrote in message
news:OH******** ******@TK2MSFTN GP11.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
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.u k> wrote in message
news:OH******** ******@TK2MSFTN GP11.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
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.u k> wrote in message
news:es******** ******@TK2MSFTN GP12.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.co m> wrote in message
news:eb******** ******@TK2MSFTN GP10.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.u k> wrote in message
news:OH******** ******@TK2MSFTN GP11.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
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.co m> wrote in message
news:eG******** ******@TK2MSFTN GP09.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.u k> wrote in message
news:es******** ******@TK2MSFTN GP12.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.co m> wrote in message
news:eb******** ******@TK2MSFTN GP10.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.u k> wrote in message
news:OH******** ******@TK2MSFTN GP11.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
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.co m> wrote in message
news:eG******** ******@TK2MSFTN GP09.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.u k> wrote in message
news:es******** ******@TK2MSFTN GP12.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.co m> wrote in message
news:eb******** ******@TK2MSFTN GP10.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.u k> wrote in message
> news:OH******** ******@TK2MSFTN GP11.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1304
by: Bisbal | last post by:
Hi All, I have created a class that simulates a MDI form by putting the 'child' inside a panel located in the 'parent' form. I had to do this because we use a custom UI that doesn't work properly with standard MDI forms. The constructor of the class is something like SemiMDI(System.Windows.Forms.Form client,System.Windows.Forms.Panel...
2
374
by: alien2_51 | last post by:
I want the grid I'm using in a winform application to resize on the maximize/minimize events and form resize events, whats the best way to do this, a sample would be helpful also..?
2
1860
by: Jason | last post by:
Hello I've created a form that serves as a front end for a DB. My question is how to resize the form, and have the control on the form resize themselves as i drag the form. I've got a status bar added to the bottom of the form, but when I use the mouse to drag the right bottom corner, the form itself will resize, but nothing else will...
0
1849
by: Patrick Lioi | last post by:
We have form that is used as the base class of all of our forms, let's call it BaseApplicationForm. We have another form, say ChildApplicationForm that inherits from BaseApplicationForm. The child form implements an event handler for the Resize event. Inside BaseApplicationForm.InitializeComponent, this.ClientSize is set to a value. On...
3
1676
by: Andy | last post by:
Hello, everyone, I am writing a segment of code for listing the permutation of some event sequences. I tried to use template to make the code more general. When I commented the code as shown below, the code works okay. Otherwise, it will goes to seg fault. I am puzzled on this. Can anybody give me any hints?
11
3463
by: Ajith Menon | last post by:
I have created a windows application in which the form needs to be resized on the MouseMove event. The windows resize function takes a lot of CPU cycles. And as the resize function is called on the MouseMove, the form is resized around a 30-100 times in one second. This leads to a high CPU utilization and all other application comes to a stand...
9
5278
by: dli07 | last post by:
Hello, I'm trying to convert a piece of code that creates a dynamic vertical resizing bar in a table from internet explorer to firefox. It's based on a post from http://blogs.crankygoblin.com/blogs/geoff.appleby/pages/50712.aspx. I've also read the post on this topic by bggraphics, but he doesn't arrive at a final result. The main problem I...
0
1583
by: Peter Anthony | last post by:
It seems kind of strange that if a Form is just moved that Resize events fire. This makes it hard to tell the difference betweeen resizing and moving a Form. I can understand why resizing might also be considered a move (since the Form's location can be thought to be based on one from Top/Bottom and one from Left/Right, and some of these...
6
5773
by: Tarren | last post by:
Hi: I am trying to get access to the event after a window has been resized. The events I have been using SizeChanged and Resize all fire after any pixel size change. What I am trying to achieve is after the window has been dragged to a new size (or maximized/restored) then I redraw the images within the form. If I do it on Resize,...
0
7673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6263
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.