Set element height according the screen height

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

Locked
David de Argentina
Posts: 1596
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina
Contact:

Set element height according the screen height

Post by David de Argentina »

Hi overthere,

I'm working on a program that needs to set all objects height according the phone screen height.

Main screen has a table with this settings:

Code: Select all

<table width="100%"  border="0">

    <tr>
      <td>&nbsp;</td>
      <td height="300" id="largo" colspan="7" bgcolor="#CCCCFF"> 
	     <iframe id="iframe" src="load.php" height="100%" width="100%"></iframe> 
      </td>
      <td>&nbsp;</td>
    </tr>
...
...
Note this row has a iframe into it.
I need to resize it dinamically.

the easy way i found to do this is:

a) Set the <body> tag as:

Code: Select all

<body onload="getlarge();">
b) a javascript like this:

Code: Select all

<script>
function getlarge(){
document.getElementById("largo").height=(window.innerHeight-240);
}
</script>
window.innerHeight allows to get all useable screen height,

You can use this as factor (window.innerHeight * 0.65) or as you need

Enjoy it!
David de Argentina
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: Set element height according the screen height

Post by Neosoft Support »

Very interesting. Is this something you're doing with NeoBook?
NeoSoft Support
Locked