aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/window/moveto/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/window/moveto/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/window/moveto/index.html')
-rw-r--r--files/zh-cn/web/api/window/moveto/index.html44
1 files changed, 44 insertions, 0 deletions
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
+---
+<div>{{ApiRef}}</div>
+
+<h2 id="概述">概述</h2>
+
+<p>将当前窗口移动到指定的坐标位置。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox notranslate">window.moveTo(<var>x</var>, <var>y</var>)
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<ul>
+ <li><code>x</code> 是要移动到的位置横坐标</li>
+ <li><code>y </code>是要移动到的位置纵坐标</li>
+</ul>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<pre class="brush:js notranslate">function origin() {
+ // 把窗口移动到左上角
+ window.moveTo(0, 0);
+}</pre>
+
+<h2 id="附注">附注</h2>
+
+<p>本函数按照指定的绝对位置移动当前窗口,而{{domxref("window.moveBy")}}函数按照与当前位置相对的距离移动当前窗口。</p>
+
+<p>从Firefox 7开始,如果符合<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565541#c24">下列情况</a>,则普通网页中的JavaScript无法通过调用该函数来移动浏览器窗口</p>
+
+<ol>
+ <li>当前窗口或标签页不是由{{domxref("window.open")}}方法创建的</li>
+ <li>当前标签页所在的窗口包含有多个标签页</li>
+</ol>
+
+<h2 id="规范">规范</h2>
+
+<p>{{dom0}}</p>