aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/date/tolocaledatestring/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/date/tolocaledatestring/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/date/tolocaledatestring/index.html18
1 files changed, 9 insertions, 9 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaledatestring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/tolocaledatestring/index.html
index 407050f518..080fdffba4 100644
--- a/files/zh-cn/web/javascript/reference/global_objects/date/tolocaledatestring/index.html
+++ b/files/zh-cn/web/javascript/reference/global_objects/date/tolocaledatestring/index.html
@@ -11,11 +11,11 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString
-<h2 id="Syntax" name="Syntax">语法</h2>
+<h2 id="Syntax">语法</h2>
<pre class="syntaxbox"><var>dateObj</var>.toLocaleDateString([locales [, options]])</pre>
-<h3 id="Parameters" name="Parameters">参数</h3>
+<h3 id="Parameters">参数</h3>
<p> 查看<a href="#Browser_Compatibility" title="#Browser_Compatibility">浏览器兼容性</a>小节,看下哪些浏览器支持 <code>locales</code> 和 <code>options</code> 参数,还可以参看<a href="#Example:_Checking_for_support_for_locales_and_options_arguments">例子: 检测 <code>locales</code> 和 <code>options</code> 参数支持情况</a>。</p>
@@ -23,9 +23,9 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString
<p>The default value for each date-time component property is <code>undefined</code>, but if the <code>weekday</code>, <code>year</code>, <code>month</code>, <code>day</code> properties are all <code>undefined</code>, then <code>year</code>, <code>month</code>, and <code>day</code> are assumed to be "numeric".</p>
-<h2 id="Examples" name="Examples">例子</h2>
+<h2 id="Examples">例子</h2>
-<h3 id="Example:_Using_toLocaleDateString" name="Example:_Using_toLocaleDateString">例子:使用<code>toLocaleDateString</code></h3>
+<h3 id="Example:_Using_toLocaleDateString">例子:使用<code>toLocaleDateString</code></h3>
<p>没有指定语言环境(locale)时,返回一个使用默认语言环境和格式设置(options)的格式化字符串。</p>
@@ -36,7 +36,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString
date.toLocaleDateString();
// → "12/11/2012" if run in en-US locale with time zone America/Los_Angeles</pre>
-<h3 id="Example:_Checking_for_support_for_locales_and_options_arguments" name="Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</h3>
+<h3 id="Example:_Checking_for_support_for_locales_and_options_arguments">例子:检测 <code>locales</code> 和 <code>options</code> 参数支持情况</h3>
<p><code>locales</code> 和 <code>options</code> 参数不是所有的浏览器都支持。为了检测一种实现环境(implementation)是否支持它们,可以使用不合法的语言标签,如果实现环境支持该参数,则会抛出一个 <code>RangeError</code> 异常,反之会忽略参数。</p>
@@ -50,7 +50,7 @@ date.toLocaleDateString();
}
</pre>
-<h3 id="Example:_Using_locales" name="Example:_Using_locales">例子:使用<code>locales</code></h3>
+<h3 id="Example:_Using_locales">例子:使用<code>locales</code></h3>
<p>下例展示了本地化日期格式的一些变化。为了在应用的用户界面得到某种语言的日期格式,必须确保使用 <code>locales</code> 参数指定了该语言(可能还需要设置某些回退语言)。</p>
@@ -86,7 +86,7 @@ alert(date.toLocaleDateString(["ban", "id"]));
// → "20/12/2012"
</pre>
-<h3 id="Example:_Using_options" name="Example:_Using_options">例子:使用<code>options</code></h3>
+<h3 id="Example:_Using_options">例子:使用<code>options</code></h3>
<p>可以使用 <code>options </code>参数来自定义 <code>toLocaleDateString</code> 方法返回的字符串。</p>
@@ -104,7 +104,7 @@ alert(date.toLocaleDateString("en-US", options));
// → "Thursday, December 20, 2012, GMT"
</pre>
-<h2 id="Performance" name="Performance">性能</h2>
+<h2 id="Performance">性能</h2>
<p>当格式化大量日期时,最好创建一个 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat" title="/en-US/docs/JavaScript/Reference/Global_Objects/DateTimeFormat"><code>Intl.DateTimeFormat</code></a> 对象,然后使用该对象 <a href="/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/format" title="/en-US/docs/JavaScript/Reference/Global_Objects/DateTimeFormat/format"><code>format</code></a> 属性提供的方法。</p>
@@ -144,7 +144,7 @@ alert(date.toLocaleDateString("en-US", options));
<p>{{Compat("javascript.builtins.Date.toLocaleDateString")}}</p>
-<h2 id="See_Also" name="See_Also">相关链接</h2>
+<h2 id="See_Also">相关链接</h2>
<ul>
<li>{{jsxref("Global_Objects/DateTimeFormat", "DateTimeFormat")}}</li>