Hallo Everybody,

I'm trying to set my div height in accordance with the webpage height (the height of the viewable area without scrolling), to do that i'm facing some problems with which I request you for your help.

the ASP page is written in vbscript:
<head>
...
</head>
<body>
<%
...
response.write "<div id='projList' style='overflow-x:none;overflow-y:auto;height:300px; padding:0px;'>"
...
%>
</body>

i need to make div height (projList) not fixed as 300px because depending on viewer screen resolution this might make the div too small (waste of space) or beyond one page view.

to do this i am thinking of calculating the browser viewport height to make the div height dynamically adjusting so that it takes an optimal height.

i tried to achive this in the follwing ways:
1. using 'screen.height'
<body>
<%
...
dim h
h = screen.height
response.write "<div id='projList' style='overflow-x:none;overflow-y:auto;height:" & h & "px; padding:0px;'>"
...
%>
</body>
but i was getting this error on execution, did not find any solution how to use 'screen'
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'screen'

2. tried using a javascript function called from the vbscript function
<head>
...
<script type="text/javascript">
function setProjListDiv() {
alert($(window).height());
}
<%
function testVB()
setProjListDiv()
end function
%>
</head>
<body>
<%
...
testVB()
response.write "<div id='projList' style='overflow-x:none;overflow-y:auto; padding:0px;'>"
...
%>
</body>
my plan was to set the height attribute in the javascript, but i was unable to make the call from vbscript function to javascript, the vbscript function 'testVB()' is called successfully, but not the javascript function 'setProjListDiv()' from that vbscript func, always getting the same undefined varibale error as below:
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'setProjListDiv'

i saw many examples in net that calling a javascript from vbscript is pretty straight forward, but in my case i can't understand why its not happening.

3. is there any way to call a javascript function on some event in the <div> element, so the javascript function is called before the div is displayed in webpage, but i found that many said 'onLoad' event does not work for 'div' element.

please help me in this problem, any way to make this work would be very helpful for me.

thank you.