From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/window/moveto/index.html | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 files/zh-cn/web/api/window/moveto/index.html (limited to 'files/zh-cn/web/api/window/moveto/index.html') diff --git a/files/zh-cn/web/api/window/moveto/index.html b/files/zh-cn/web/api/window/moveto/index.html new file mode 100644 index 0000000000..b817540bc9 --- /dev/null +++ b/files/zh-cn/web/api/window/moveto/index.html @@ -0,0 +1,44 @@ +--- +title: window.moveTo +slug: Web/API/Window/moveTo +translation_of: Web/API/Window/moveTo +--- +
{{ApiRef}}
+ +

概述

+ +

将当前窗口移动到指定的坐标位置。

+ +

语法

+ +
window.moveTo(x, y)
+
+ +

参数

+ + + +

示例

+ +
function origin() {
+  // 把窗口移动到左上角
+  window.moveTo(0, 0);
+}
+ +

附注

+ +

本函数按照指定的绝对位置移动当前窗口,而{{domxref("window.moveBy")}}函数按照与当前位置相对的距离移动当前窗口。

+ +

从Firefox 7开始,如果符合下列情况,则普通网页中的JavaScript无法通过调用该函数来移动浏览器窗口

+ +
    +
  1. 当前窗口或标签页不是由{{domxref("window.open")}}方法创建的
  2. +
  3. 当前标签页所在的窗口包含有多个标签页
  4. +
+ +

规范

+ +

{{dom0}}

-- cgit v1.2.3-54-g00ecf