xjs*_*iya 3 javascript scrollbar
我有一个功能,在中心弹出窗口,我希望它有一个垂直滚动条.
function popUpCal()
{
var url = "calendar_flight_maint.php";
var width = 700;
var height = 600;
var left = parseInt((screen.availWidth/2) - (width/2));
var top = parseInt((screen.availHeight/2) - (height/2));
var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
window.open(url, "subWind", windowFeatures, "POS", "toolbar=no", "scrollbars=1");
}
Run Code Online (Sandbox Code Playgroud)
我已经试过scrollbars=yes,scrollbars=auto,scrollbars=1但仍滚动条没有出现.我的代码有问题吗?我正在使用Firefox 21.0,我已经在IE 8中测试过了.这似乎是什么问题?
Rie*_*u͢s 15
如window.open的规范所示,您的参数是错误的.试试这个:
function popUpCal()
{
var url = "calendar_flight_maint.php";
var width = 700;
var height = 600;
var left = parseInt((screen.availWidth/2) - (width/2));
var top = parseInt((screen.availHeight/2) - (height/2));
var windowFeatures = "width=" + width + ",height=" + height +
",status,resizable,left=" + left + ",top=" + top +
"screenX=" + left + ",screenY=" + top + ",scrollbars=yes";
window.open(url, "subWind", windowFeatures, "POS");
}
Run Code Online (Sandbox Code Playgroud)
这是一个jsFiddle