diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/dataview/byteoffset/index.html | 67 |
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> |