aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset/index.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset/index.html b/files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset/index.html
new file mode 100644
index 0000000000..9335006969
--- /dev/null
+++ b/files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset/index.html
@@ -0,0 +1,67 @@
+---
+title: DataView.prototype.byteOffset
+slug: Web/JavaScript/Reference/Global_Objects/DataView/byteOffset
+translation_of: Web/JavaScript/Reference/Global_Objects/DataView/byteOffset
+---
+<div>{{JSRef}}</div>
+
+<p> <strong><code>byteOffset</code></strong> 属性描述了从 {{jsxref("ArrayBuffer")}} 开始的字节偏移量。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/dataview-byteoffset.html")}}</div>
+
+
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><var>dataview</var>.byteOffset</pre>
+
+<h2 id="描述">描述</h2>
+
+<p> <code>byteOffset</code> 属性是一个获取(accessor)属性,它的 set 属性为 undefined,这意味着它是只读的。值在 <code>DataView 被创建时就确定了,且不能改变。</code></p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="使用_byteOffset_属性"><code>使用 byteOffset 属性</code></h3>
+
+<pre class="brush:js">var buffer = new ArrayBuffer(8);
+var dataview = new DataView(buffer);
+dataview.byteOffset; // 0 (没有指定偏移量)
+
+var dataview2 = new DataView(buffer, 3);
+dataview2.byteOffset; // 3 (在构造DataView时指定)
+</pre>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-get-dataview.prototype.byteoffset', 'DataView.prototype.byteOffset')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-get-dataview.prototype.byteoffset', 'DataView.prototype.byteOffset')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("javascript.builtins.DataView.byteOffset")}}</p>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li>{{jsxref("DataView")}}</li>
+ <li>{{jsxref("ArrayBuffer")}}</li>
+</ul>