aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/conflicting/web
diff options
context:
space:
mode:
authorMDN <actions@users.noreply.github.com>2021-08-27 00:49:43 +0000
committerMDN <actions@users.noreply.github.com>2021-08-27 00:49:43 +0000
commit5d18c06cf65a281de4d382e124140f1557e67637 (patch)
tree3985c9164ff853305254cd7966188c61d6138d43 /files/zh-cn/conflicting/web
parent06cc44fd40dcbe1218c55703ccd7628ac700242f (diff)
downloadtranslated-content-5d18c06cf65a281de4d382e124140f1557e67637.tar.gz
translated-content-5d18c06cf65a281de4d382e124140f1557e67637.tar.bz2
translated-content-5d18c06cf65a281de4d382e124140f1557e67637.zip
[CRON] sync translated content
Diffstat (limited to 'files/zh-cn/conflicting/web')
-rw-r--r--files/zh-cn/conflicting/web/api/mouseevent/pagex/index.html106
-rw-r--r--files/zh-cn/conflicting/web/api/mouseevent/pagey/index.html90
2 files changed, 196 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/api/mouseevent/pagex/index.html b/files/zh-cn/conflicting/web/api/mouseevent/pagex/index.html
new file mode 100644
index 0000000000..7089c102a8
--- /dev/null
+++ b/files/zh-cn/conflicting/web/api/mouseevent/pagex/index.html
@@ -0,0 +1,106 @@
+---
+title: UIEvent.pageX
+slug: conflicting/Web/API/MouseEvent/pageX
+translation_of: Web/API/UIEvent/pageX
+original_slug: Web/API/UIEvent/pageX
+---
+<p>{{APIRef("DOM Events")}} {{Non-standard_header}}</p>
+
+<p><code><strong>UIEvent.pageX</strong></code> 是只读属性,它返回相对于整个文档的水平坐标。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="syntaxbox">var <em>pos</em> = <em>event</em>.pageX</pre>
+
+<h2 id="Syntax" name="Syntax">示例</h2>
+
+<pre><em>var pageX</em> = <em>event</em>.pageX;</pre>
+
+<p><code><em>pageX</em></code>  是鼠标事件触发时,鼠标指针相对于整个文档 X 坐标上像素点的整数值。这一属性同时也参照了页面的水平滚动距离。</p>
+
+<pre class="brush: js">&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;pageX\pageY &amp; layerX\layerY example&lt;/title&gt;
+
+&lt;script type="text/javascript"&gt;
+
+function showCoords(evt){
+ var form = document.forms.form_coords;
+ var parent_id = evt.target.parentNode.id;
+ form.parentId.value = parent_id;
+ form.pageXCoords.value = evt.pageX;
+ form.pageYCoords.value = evt.pageY;
+ form.layerXCoords.value = evt.layerX;
+ form.layerYCoords.value = evt.layerY;
+}
+
+&lt;/script&gt;
+
+&lt;style type="text/css"&gt;
+
+ #d1 {
+ border: solid blue 1px;
+ padding: 20px;
+ }
+
+ #d2 {
+ position: absolute;
+ top: 180px;
+ left: 80%;
+ right:auto;
+ width: 40%;
+ border: solid blue 1px;
+ padding: 20px;
+ }
+
+ #d3 {
+ position: absolute;
+ top: 240px;
+ left: 20%;
+ width: 50%;
+ border: solid blue 1px;
+ padding: 10px;
+ }
+
+&lt;/style&gt;
+&lt;/head&gt;
+
+&lt;body onmousedown="showCoords(event)"&gt;
+
+&lt;p&gt;To display the mouse coordinates please click anywhere on the page.&lt;/p&gt;
+
+&lt;div id="d1"&gt;
+&lt;span&gt;This is an un-positioned div so clicking it will return
+layerX/layerY values almost the same as pageX/PageY values.&lt;/span&gt;
+&lt;/div&gt;
+
+&lt;div id="d2"&gt;
+&lt;span&gt;This is a positioned div so clicking it will return layerX/layerY
+values that are relative to the top-left corner of this positioned
+element. Note the pageX\pageY properties still return the
+absolute position in the document, including page scrolling.&lt;/span&gt;
+
+&lt;span&gt;Make the page scroll more! This is a positioned div so clicking it
+will return layerX/layerY values that are relative to the top-left
+corner of this positioned element. Note the pageX\pageY properties still
+return the absolute position in the document, including page
+scrolling.&lt;/span&gt;
+&lt;/div&gt;
+
+&lt;div id="d3"&gt;
+&lt;form name="form_coords"&gt;
+ Parent Element id: &lt;input type="text" name="parentId" size="7" /&gt;&lt;br /&gt;
+ pageX:&lt;input type="text" name="pageXCoords" size="7" /&gt;
+ pageY:&lt;input type="text" name="pageYCoords" size="7" /&gt;&lt;br /&gt;
+ layerX:&lt;input type="text" name="layerXCoords" size="7" /&gt;
+ layerY:&lt;input type="text" name="layerYCoords" size="7" /&gt;
+&lt;/form&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+
+<h2 id="Specification" name="Specification">规范</h2>
+
+<p>这一属性不在规范中。</p>
diff --git a/files/zh-cn/conflicting/web/api/mouseevent/pagey/index.html b/files/zh-cn/conflicting/web/api/mouseevent/pagey/index.html
new file mode 100644
index 0000000000..f4c92daa4e
--- /dev/null
+++ b/files/zh-cn/conflicting/web/api/mouseevent/pagey/index.html
@@ -0,0 +1,90 @@
+---
+title: event.pageY
+slug: conflicting/Web/API/MouseEvent/pageY
+translation_of: Web/API/UIEvent/pageY
+original_slug: Web/API/UIEvent/pageY
+---
+<p>{{ ApiRef() }}</p>
+<h3 id="Summary" name="Summary">概述</h3>
+<p>返回事件发生时相对于整个文档的纵坐标.</p>
+<h3 id="Syntax" name="Syntax">语法</h3>
+<pre class="eval"><em>var pageY</em> = <em>event</em>.pageY;
+</pre>
+<p><code>pageY</code> 是事件发生时鼠标指针所在位置相对于整个文档的纵坐标,单位为像素.该属性会考虑到页面滚动条的高度.</p>
+<h3 id="Example" name="Example">例子</h3>
+<pre>&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;pageX\pageY &amp; layerX\layerY example&lt;/title&gt;
+
+&lt;script type="text/javascript"&gt;
+
+function showCoords(evt){
+ var form = document.forms.form_coords;
+ var parent_id = evt.target.parentNode.id;
+ form.parentId.value = parent_id;
+ form.pageXCoords.value = evt.pageX;
+ form.pageYCoords.value = evt.pageY;
+ form.layerXCoords.value = evt.layerX;
+ form.layerYCoords.value = evt.layerY;
+}
+
+&lt;/script&gt;
+
+&lt;style type="text/css"&gt;
+
+ #d1 {
+ border: solid blue 1px;
+ padding: 20px;
+ }
+
+ #d2 {
+ position: absolute;
+ top: 180px;
+ left: 80%;
+ right:auto;
+ width: 40%;
+ border: solid blue 1px;
+ padding: 20px;
+ }
+
+ #d3 {
+ position: absolute;
+ top: 240px;
+ left: 20%;
+ width: 50%;
+ border: solid blue 1px;
+ padding: 10px;
+ }
+
+&lt;/style&gt;
+&lt;/head&gt;
+
+&lt;body onmousedown="showCoords(event)"&gt;
+
+&lt;p&gt;要显示鼠标所在位置的坐标,请点击页面上的任意地方.&lt;/p&gt;
+
+&lt;div id="d1"&gt;
+&lt;span&gt;这是一个未定位的div(没有指定css position属性),所以点击它返回的layerX/layerY值几乎和pageX/PageY值完全相同.&lt;/span&gt;
+&lt;/div&gt;
+
+&lt;div id="d2"&gt;
+&lt;span&gt;<span id="result_box" lang="zh-CN"><span>这是一个</span><span>已定位的div</span><span>,因此</span><span>点击它</span><span>时返回</span><span>的layerX</span><span>/</span><span class="hps">layerY的值是相对于自己左上角(</span></span>top-left<span id="result_box" lang="zh-CN"><span class="hps">)位置的坐标值.</span>
+<span>然而</span><span>pageX</span><span>/</span><span class="hps">pageY</span><span>属性</span><span>仍</span><span>返回该div在</span><span>文档中</span><span>的</span><span>绝对位置</span><span>,</span><span>包括页面</span><span>滚动</span></span>高度.&lt;/span&gt;
+&lt;/div&gt;
+
+&lt;div id="d3"&gt;
+&lt;form name="form_coords"&gt;
+ 父元素id: &lt;input type="text" name="parentId" size="7" /&gt;&lt;br /&gt;
+ pageX:&lt;input type="text" name="pageXCoords" size="7" /&gt;
+ pageY:&lt;input type="text" name="pageYCoords" size="7" /&gt;&lt;br /&gt;
+ layerX:&lt;input type="text" name="layerXCoords" size="7" /&gt;
+ layerY:&lt;input type="text" name="layerYCoords" size="7" /&gt;
+&lt;/form&gt;
+&lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
+</pre>
+<h3 id="Specification" name="Specification">规范</h3>
+<p>不属于任何公开的标准.</p>
+<p>{{ languages( {"pl": "pl/DOM/event.pageY","en": "en/DOM/event.pageY" } ) }}</p>