Saturday, June 23, 2012

Javascript get screen height and width

function fnGetScreenSize()
{
var screenW = 640, screenH = 480;
if (parseInt(navigator.appVersion)>3)
{
screenW = screen.width;
screenH = screen.height;
}
else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled())
{
var jToolkit = java.awt.Toolkit.getDefaultToolkit();
var jScreenSize = jToolkit.getScreenSize();
screenW = jScreenSize.width;
screenH = jScreenSize.height;
}
return screenW;
}
intWidth = fnGetScreenSize();

No comments:

Post a Comment

Please mention your comments.......