簡體   English   中英

帶有/不帶有垂直滾動條的幫助窗口

[英]A help window with/without vertical scrollbar

我正在嘗試在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>   

有任何想法嗎 ? 謝謝。

您是否嘗試過應用CSS規則

<style>.myDiv{ overflow:scroll}</style> <div class="myDiv"> some content </div>

當內容超過指定的容器大小時,將提供滾動條,並在內容適合時將其省略。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM