I am trying to implement a help function in a web application. By pressing F1, a pop-up window shall be displayed with, or not, a vertical scrollbar.
$(document).keydown(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '112'){ //F1
popup("help.php");
}
});
The popup function should open a new window in the middle of the screen.
function popup(page)
{
height = '220';
width = '440';
var str = "height=" + height + ",innerHeight=" + height;
str += ",width=" + width + ",innerWidth=" + width;
if (window.screen) {
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
var xc = (aw - width) / 2;
var yc = (ah - height) / 2;
str += ",left=" + xc + ",screenX=" + xc;
str += ",top=" + yc + ",screenY=" + yc;
};
str += ",scrollbars=1";
window.open(page,"name",str);
}
The popup window is correctly displayed but there is NO scrollbar !
The help.php is like this:
<?php
// for the time beeing, feed with html code. Later this script will open a
// contextual help by using header("location: help_fx.php")
?>
<div>
1<br>
2<br>
3<br>
4<br>
5<br>
6<br>
7<br>
8<br>
9<br>
10<br>
11<br>
12<br>
13<br>
14<br>
</div>
Any ideas ? Thank you.