我正在尝试在 Web 应用程序中实现帮助功能。通过按 F1,将显示一个弹出窗口,带有或不带有垂直滚动条。
$(document).keydown(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '112'){ //F1
popup("help.php");
}
});
弹出功能应在屏幕中间打开一个新窗口。
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);
}
弹出窗口正确显示,但没有滚动条!
help.php 是这样的:
<?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>
有任何想法吗 ?谢谢你。