Hi Andy,
Assuming you only need to adjust the size of some html elements to the
screen size, you could do resizing entirely in javascript by something like:
<HTML><HEAD></HEAD>
<BODY onResize="scaleContent()>
<script>
function scaleContent() {
getElement('itemTableDiv').style.height=(window.do cument.body.clientHeight)-179;
getElement('itemTableDiv').style.width=(window.doc ument.body.clientWidth)-130;
}
function getElement( elementId)
{
var element;
if (document.all) {
element = document.all[elementId];
}
else if (document.getElementById) {
element = document.getElementById(elementId);
}
else element = -1;
return element;
}
</script>
<div id=itemTableDiv style='height: 300px; width: 600px; overflow:
auto;' valign='top'>
<?php printItemTablePart() ?>
</div>
<script> scaleContent(); </script>
</BODY>
</HTML>
This resizes a DIV according to screen size minus (130, 179). You can
fill in different values to make it larger or smaller, or print the
proper values from php. It works in recent versions of both IE and
Mozilla, (not in Nescape 4.x). Of course you need to write the
printItemTablePart() function in php to produce the content of the div,
or just print it some other way from php.
This javascript will probably work on other types of html elements too,
as long as you give each one a different id, and as long as the scaling
is not making them too small for their own elements to fit in. Be aware
that the second script must be AFTER the definition of the elements that
are resized and after the functions that are called.
Greetings,
Henk Verhoeven,
www.phpPeanuts.org
Andy R. wrote:
Hello everyone,
I've spent quite some time now, looking for some information on how to
get this done, sadly none has helped me much, though.
I have a bit of java scrpt on a webpage (.php) to aquire the screen
resolution of the visiting user. Now I need to pass the java variable
to another variable on the same document.
I have a feeling, this will not be easy - as java is client- and php
server-sided. Now, if my assumption is corect, then it will be
neccessary to generate the page via .php on the webserver and send it
to the browser. Once loaded, java will be executed to aquire the used
screen resolution. These values (height/width) will have to be
returned to the server, prob. via post. The server will now have to
acknowledge the presence of these values and regenerate the webpage
once more, this time using the provided values.
I hope I've got it so far. Problem is - I don't have a clue about java
and only basics in php. Please help me get this accomplished, abd
don't forget: I'm not java savy.
kind regards,
Andy R.