【发布时间】:2019-07-31 13:31:40
【问题描述】:
我正在尝试使用一些 JavaScript 在 Chrome 中打开新窗口:
var windowTask = window.open("http://localhost/testapp/site/windows/formTask.html", "taskForm", "width=800, height=500, toolbar=yes, menubar=yes, scrollbars=no");
但是,当它打开时,它没有菜单栏和工具栏,但它有滚动条。我做错了什么?
完整代码为:
<div id="box" style="height:90%; width:100%;">
<script>
dtable = new webix.ui({
container:"box",
view:"datatable",
columns:[
{ id: "taskID", header: "Task ID", fillspace: true},
{ id: "title", header: "Title", fillspace: true},
{ id: "status", header: "Status", fillspace: true},
{ id: "creator", header: "Creator", fillspace: true},
{ id: "description", header: "Description", fillspace: true},
{ id: "responsible", header: "Responsible", fillspace: true},
{ id: "dateCreation", header: "Date creation", fillspace: true},
{ id: "dateStart", header: "Date start", fillspace: true},
{ id: "dateFinish", header: "Date finish", fillspace: true}
],
url:"http://localhost/testapp/php/tasks/getTaskList.php",
select:"row",
on:{"onItemDblClick": function () {
var selectedRow = dtable.getSelectedItem();
var windowTask = window.open("http://localhost/testapp/site/windows/formTask.html", "taskForm", "width=800,height=500,toolbar=1,menubar=1,scrollbars=0");
windowTask.onload = function(){
windowTask.document.getElementById("taskID").value = selectedRow.taskID;
windowTask.document.getElementById("title").value = selectedRow.title;
windowTask.document.getElementById("status").value = selectedRow.status;
windowTask.document.getElementById("creator").value = selectedRow.creator;
windowTask.document.getElementById("responsible").value = selectedRow.responsible;
windowTask.document.getElementById("description").value = selectedRow.description;
windowTask.document.getElementById("dateCreation").value = selectedRow.dateCreation;
windowTask.document.getElementById("dateStart").value = selectedRow.dateStart;
windowTask.document.getElementById("dateFinish").value = selectedRow.dateFinish;
}
}}
});
</script>
</div>
总结:
在 Mozilla 中此代码:
var windowTask = window.open("localhost/testapp/site/windows/formTask.html", "taskForm", "width=800,height=500,toolbar=1,menubar=1,scrollbars=0");
工作正常,但在 Chrome 中:
var windowTask = window.open("localhost/testapp/site/windows/formTask.html", "taskForm", "width=800,height=500,toolbar=1,menubar=1,scrollbars=0");
还有这个:
var windowTask = window.open("localhost/testapp/site/windows/formTask.html", "taskForm", "width=800,height=500,toolbar=true,menubar=true,scrollbars=false");
还有这个:
var windowTask = window.open("localhost/testapp/site/windows/formTask.html", "taskForm", "width=800,height=500,toolbar=yes,menubar=yes,scrollbars=no");
仍然没有给我菜单栏和工具栏,并且启用了滚动条。怎么了?
【问题讨论】:
-
如果您需要真正的窗口功能,只需在新选项卡中打开它即可。这样,您将拥有所需的一切。要在新选项卡中打开它,只需从字符串中省略宽度和高度。
标签: javascript