我正在尝试使用一些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");
仍然没有给我梅纳巴尔和工具栏,并启用了滚动条。怎么了?
根据规格,选项字符串应具有 no whitespace。
一个包含与逗号分隔的窗口特征列表,其相应值以" name = value"形式给出。这些功能包括选项,例如窗口的默认尺寸和位置,是否包括滚动条等。字符串中必须没有空格。有关可以指定的每个功能的文档,请参见下面的窗口功能。
我已经相应地调整了您的行。
var windowTask = window.open(
"http://localhost/testapp/site/windows/formTask.html",
"taskForm",
"width=800,height=500,toolbar=yes,menubar=yes,scrollbars=no"
);
您是否尝试过将其更改为menubar=1
和toolbar=1
或menubar=true
和toolbar=true
。将滚动条更改为scrollbars=0
将禁用滚动条。他们也不应包含任何空格。
最终代码应该看起来像:
window.open("http://localhost/testapp/site/windows/formTask.html",
"taskForm",
"width=800,height=500,toolbar=yes,menubar=yes,scrollbars=no");