PDA

View Full Version : Javascript Menu


sanraje
01-15-2001, 02:00 AM
I want to add menu In Javascript whch should come out of boowswer if window size is smaller.i.e.It should be always at the top

kdjoergensen
01-15-2001, 10:11 AM
You can test size of window like this:

var ww=0;
var wh=0;
if (document.all) {
ww = document.body.clientWidth;
wh = document.body.clientHeight;
else if (document.layers | | document.getElementById) {
ww = window.innerWidth;
wh = window.innerHeight;
}

window.onblur = focusWin;
function focusWin(){
if (ww < 200 && wh < 150) {
self.focus();
}
}

Above is put focus on a window (if focus removed from it) if the windows size is less than a width of 200 pixels and 150 pixels height.