A javascript function is being called at the time of page loading which is returning multiple values and i need to receive those values. What should i specify in form or body tag so as to make use of those values in my jsp page?
The code i am using is:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
function Browser()
{
var myWidth;
var myHeight;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
return {myWidth:myWidth, myHeight:myHeight};
}
</script>
</head>
<body onload="Browser()">
<form name="hello" action="" method="post" >
<table align="center" border="1">
<tr>
<td>
User Name:
</td>
<td>
<input type="text" name="user"/>
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="pwd"/>
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" value="Submit"/>
</td>
</tr>
</table>
</form>
</body>
</html>
In the above code function Browser is returning the resolution values and i had called that function using onload() method. How should i receive those values of myWidth and myHeight so as to use them in the same jsp page?