aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/document/createexpression/index.html
blob: 50636d18748a9393accfcdfbca85ac607459a042 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
title: document.createExpression
slug: Web/API/Document/createExpression
translation_of: Web/API/Document/createExpression
---
<p>{{ ApiRef() }}</p>
<p>该方法将编译生成一个 <code><a href="/zh-cn/XPathExpression" title="zh-cn/XPathExpression">XPathExpression</a></code> ,可以用来多次的执行.</p>
<h3 id="Syntax" name="Syntax">语法</h3>
<pre class="eval"><em>xpathExpr</em> = <em>document</em>.createExpression(<em>xpathText</em>, <em>namespaceURLMapper</em>);
</pre>
<h3 id="Arguments" name="Arguments">参数</h3>
<ul>
 <li>String <code>xpathText</code> (将要编译的Xpath表达式)</li>
 <li>Function <code>namespaceURLMapper</code> (将一个命名空间前缀映射到一个命名空间URL上 (如果不需要,可以为<code>null</code>))</li>
</ul>
<p>{{ Fx_minversion_note("3") }}</p>
<h3 id="Return" name="Return">返回值</h3>
<p><a href="/zh-cn/XPathExpression" title="zh-cn/XPathExpression">XPathExpression</a></p>
<p>{{ languages( {"en": "en/DOM/document.createExpression" } ) }}</p>