diff options
Diffstat (limited to 'files/zh-tw/web/api/document/createrange/index.html')
-rw-r--r-- | files/zh-tw/web/api/document/createrange/index.html | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/files/zh-tw/web/api/document/createrange/index.html b/files/zh-tw/web/api/document/createrange/index.html new file mode 100644 index 0000000000..93703c54bb --- /dev/null +++ b/files/zh-tw/web/api/document/createrange/index.html @@ -0,0 +1,33 @@ +--- +title: Document.createRange() +slug: Web/API/Document/createRange +translation_of: Web/API/Document/createRange +--- +<div>{{APIRef("DOM")}}</div> + +<p>回傳一 {{domxref("Range")}} 物件。</p> + +<h2 id="Syntax" name="Syntax">語法</h2> + +<pre class="syntaxbox">range = document.createRange(); +</pre> + +<p><code>創造 range</code> 為 {{domxref("Range")}} 物件.</p> + +<h2 id="Example" name="Example">示例</h2> + +<pre class="brush:js">var range = document.createRange(); + +range.setStart(startNode, startOffset); +range.setEnd(endNode, endOffset); +</pre> + +<h2 id="Notes" name="Notes">註意</h2> + +<p>當 <code>Range</code> 被創建之後,必須先設定其範圍初始點及結束點, 才能使用大部分 {{domxref("Range")}} 所提供的方法。</p> + +<h2 id="Specification" name="Specification">規範</h2> + +<ul> + <li><a class="external" href="http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level2-DocumentRange-method-createRange">DOM Level 2 Range: DocumentRange.createRange</a></li> +</ul> |