Click to See Complete Forum and Search --> : table size controller


merry
02-10-2003, 04:18 AM
Whether that possible to do ...?
I have the table w=100% , contain other tables with various information and images.
I do not want resize browsers window with command window.open , but I want that the table size is under control.
If screen width>=1024
table size=1024x740
else table size=100%

How to write that script? Help please!

Look:
http://www.hot.ee/kris104

Thank You very much.
kjutt@hot.ee
:)

AdamGundry
02-10-2003, 04:34 AM
You can use the screen object to find out the information you need, with an if statement like this (in place of your <table> tag):

<script type="text/javascript">
if (screen.width >= 1024){
document.write('<table width="1024" height="740" border="0" cellspacing="0" cellpadding="0">');
} else {
document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0">');
}
</script>


Adam

merry
02-10-2003, 05:46 AM
This code do not working, or I can not place it in right place...?

kjutt@hot.ee

merry
02-10-2003, 06:04 AM
after all, this code working now!
Great thank You!

:)

merry
02-10-2003, 06:22 AM
so, bat if the user resize browser window,
can the table size resize too? Mean, that table can go in (will seat?) exactly the window...?

?

AdamGundry
02-12-2003, 04:05 AM
You need to use percentage sizes for the table to resize dynamically - the pixel sizes will not do so at all.

However, you could try calling a function in the window's onResize event. In this case you would need more complicated code using the window.innerWidth or similar properties to check if the window is a certain width. You can check out information on the Window object (http://developer.netscape.com/docs/manuals/communicator/jsref/win1.htm) for more details.

Adam

merry
02-12-2003, 05:06 AM
I solved this problem. Thank You!

Look www.hot.ee/kris104 (http://www.hot.ee/kris104)

I needed, that the table suited 100% in the window, if resol. 800x600 or less, but if the monitor was bigger... the table was diffusive, ...thats I wanted fixed size for this occasion

If You find an other better possibility, then I am glad
...if You sharing it with me

:)